Morning! I was wondering if winbatch can do the following.
Currently we have our clients send us an email with attachment (csv, excel) to a inbox. Then I have PMAIL download the emails and attachments from the server to our box (pc). with in PMAIL i have filters setup to place certain clients and attachments in folders on the harddrive. Now I have 10 winbatch scripts running on a timer (every 5-15 mins) to check the folders, if any attachment (csv, excel) is found in these folders take these files and upload to our main frame. This has been working great! but would like to have winbatch handle every from getting the email and attachments to placing in correct folder, then process it.
So long story short - can winbatch download emails with attachments from hosting server and read the attachments? if so, anyone have some sample scripts?
Sounds like a job for the Postie Extender kGetMail function.
Here is a simple code sample:
AddExtender("WWPST44I.DLL")
host="mail.server.com"
fromaddr="user@server.com"
userid="username"
password="pswd"
port=""
msgnumber=""
extractfile=""
mailbox=""
flags=""
kInit(host,fromaddr,userid,password,port)
While 1
DirChange("c:\temp\attachments")
allmsgs=kGetMail(msgnumber,extractfile,"",mailbox,flags)
TimeDelay(1)
EndWhile
Exit
Reference: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WIL~Extenders/Postie+kGetMail~attachments.txt
Thanks for the quick reply! I will have used that before to send emails. Will take a look at it thanks!!
The key here is that you call the DirChange before the kGetMail to specify where to place the file attachments.
Quote from: Deana on September 27, 2013, 08:42:49 AM
The key here is that you call the DirChange before the kGetMail to specify where to place the file attachments.
Another option, especially of the destination depends on the content of the files, download everything to one folder, then use FileMove, FileCopy, or similar shell extender functions to move them around.
Quote from: DAG_P6 on September 28, 2013, 02:36:08 PM
Quote from: Deana on September 27, 2013, 08:42:49 AM
The key here is that you call the DirChange before the kGetMail to specify where to place the file attachments.
Another option, especially of the destination depends on the content of the files, download everything to one folder, then use FileMove, FileCopy, or similar shell extender functions to move them around.