Community Discussions and Support
Having trouble extracting attachments

Thanks again, Martin.

That works partially. What happens is that each message is appended to the file but it takes the form that you see when looking at the message in Raw view except that you get the headers, raw html, attachment encoding, then the attachment itself (the text from the csv).

I shall begin to manually extract the attachments. I have 5 sets of >70 attachments to extract so if anyone finds a way to get the rules to extract the attachments only and append them to a single file or to extract them to single files and to retain the original attachment name, please post.

Thanks. 

<p>Thanks again, Martin.</p><p>That works partially. What happens is that each message is appended to the file but it takes the form that you see when looking at the message in Raw view except that you get the headers, raw html, attachment encoding, then the attachment itself (the text from the csv).</p><p>I shall begin to manually extract the attachments. I have 5 sets of >70 attachments to extract so if anyone finds a way to get the rules to extract the attachments only and append them to a single file or to extract them to single files and to retain the original attachment name, please post.</p><p>Thanks. </p>

Hello

I am having trouble extracting attachments to a file.

I use the File Server Resource Manager on one of our Win2008 servers to email statistics on file size, least accessed files etc. The message that is sent contains the data in the body of an html message and also includes an attachment formatted as a csv.

I have created a general rule set and when creating the rule itself I have specified that the rule:

Only check the extension portion (csv)

Append to file (specified a filename)

When the rule is run, the contents of the html message and not the attachment are appended to a file.

Can anyone tell me what I am doing wrong, please?

Thanks 

<p>Hello</p><p>I am having trouble extracting attachments to a file.</p><p>I use the File Server Resource Manager on one of our Win2008 servers to email statistics on file size, least accessed files etc. The message that is sent contains the data in the body of an html message and also includes an attachment formatted as a csv.</p><p>I have created a general rule set and when creating the rule itself I have specified that the rule:</p><p>Only check the extension portion (csv)</p><p>Append to file (specified a filename)</p><p>When the rule is run, the contents of the html message and not the attachment are appended to a file.</p><p>Can anyone tell me what I am doing wrong, please?</p><p>Thanks </p>

Did you set the action to "Save attachment to a file" ?

Martin

<p>Did you set the action to "Save attachment to a file" ?</p><p>Martin </p>

Thanks for your reply.

 

No, I have not done this as I have 70 messages with attachments that I would like to extract to a single file. I receive 5 of these notifications each day, and I would prefer to append each attachment to the relevant csv. 

<p>Thanks for your reply.</p><p> </p><p>No, I have not done this as I have 70 messages with attachments that I would like to extract to a single file. I receive 5 of these notifications each day, and I would prefer to append each attachment to the relevant csv. </p>

OK so create a file (c:\pmail\newfile.csv) with a rule.

Add an additional rule that runs a batch job (cmd.exe c:\pmail\collect.bat) to append that file onto your collector file. ie collect.bat looks something like:

  copy c:\pmail\collector.csv + c:\pmail\newfile.csv c:\pmail\collector.csv

 erase c:\pmail\newfile.csv

 

 Does that work for you?

Martin

 

<p>OK so create a file (c:\pmail\newfile.csv) with a rule.</p><p>Add an additional rule that runs a batch job (cmd.exe c:\pmail\collect.bat) to append that file onto your collector file. ie collect.bat looks something like:</p><p>  copy c:\pmail\collector.csv + c:\pmail\newfile.csv c:\pmail\collector.csv</p><p> erase c:\pmail\newfile.csv </p><p> </p><p> Does that work for you?</p><p>Martin </p><p> </p>

Hi, Martin.

 

Thanks again for replying.

I can't get that to work and wonder if I am doing it correctly.

I have done the following:

 

Create a general rule set:

Rule 1

Attachment>Only check the extension portion>And if it contains>csv

Then do this: Extract>"\\htlincs.local\it\pmail\Greenman\file.csv"


Rule 2

Attachment>Only check the extension portion>And if it contains>csv

Then do this: Run a program>cmd.exe "\\htlincs.local\it\pmail\Greenman\large.bat"


Large.bat:

 

@echo off

copy "\\htlincs.local\it\pmail\Greenman\LargeFile.csv" + "\\htlincs.local\it\pmail\Greenman\file.csv" "\\htlincs.local\it\pmail\Greenman\LargeFile.csv"

erase \\htlincs.local\it\pmail\Greenman\file.csv

exit

 


Problem is, this does not work. Pegasus Mail is running the command, but after it has finished file.csv contains the contains of the last html email and LargeFile.csv contains nothing. I have tried this using a DFS share as shown above (the path to the Pegasus Mail executable is via a DFS namespace), and by pointing the commands to operate on my local drive.

If I run the batch file from a command prompt it works and copies the contents of file.csv to largefile.csv. 

 

Any thoughts on what I'm missing, please?

Thanks 

 

<div style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt; background-color: rgb(255, 255, 255); padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; "><p>Hi, Martin.</p><p> </p><p>Thanks again for replying.</p><p>I can't get that to work and wonder if I am doing it correctly.</p><p>I have done the following:</p><p> </p><p>Create a general rule set:</p><p>Rule 1</p><p>Attachment>Only check the extension portion>And if it contains>csv</p><p>Then do this: Extract>"\\htlincs.local\it\pmail\Greenman\file.csv"</p><p> </p><p>Rule 2</p><p>Attachment>Only check the extension portion>And if it contains>csv</p><p>Then do this: Run a program>cmd.exe "\\htlincs.local\it\pmail\Greenman\large.bat"</p><p> </p><p>Large.bat:</p><p> </p><p>@echo off</p><p>copy "\\htlincs.local\it\pmail\Greenman\LargeFile.csv" + "\\htlincs.local\it\pmail\Greenman\file.csv" "\\htlincs.local\it\pmail\Greenman\LargeFile.csv"</p><p>erase \\htlincs.local\it\pmail\Greenman\file.csv</p><p>exit</p><p> </p><p> </p><p>Problem is, this does not work. Pegasus Mail is running the command, but after it has finished file.csv contains the contains of the last html email and LargeFile.csv contains nothing. I have tried this using a DFS share as shown above (the path to the Pegasus Mail executable is via a DFS namespace), and by pointing the commands to operate on my local drive.</p><p>If I run the batch file from a command prompt it works and copies the contents of file.csv to largefile.csv. </p><p> </p><p>Any thoughts on what I'm missing, please?</p><p>Thanks </p><p> </p></div>

OK so on to plan B.   Change the action on the first rule to Append. And identify the target filename in the SET dialog button. Then if that works just delete the Run rule.

Much easier too !!

Martin

<p>OK so on to plan B.   Change the action on the first rule to Append. And identify the target filename in the SET dialog button. Then if that works just delete the Run rule. </p><p>Much easier too !! </p><p>Martin </p>
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft