copy attachments to folder

Discussion for developers using MailEnable.
Post Reply
richtalbot
Posts: 7
Joined: Mon Dec 12, 2005 11:14 am

copy attachments to folder

Post by richtalbot »

hi, have searched forum but cannot find any thread that discusses this. surely it's easy to do?

how are attachments stored on the server? i want to be able to periodically move all attachment files received from one postoffice to another.

thanks,
rich talbot

Brett Rowbotham
Posts: 560
Joined: Mon Nov 03, 2003 7:48 am
Location: Cape Town

Post by Brett Rowbotham »

Attachments are not stored separately, they are part of the mail message. Your mail client splits the mail into message and attachment(s).

Cheers,
Brett

richtalbot
Posts: 7
Joined: Mon Dec 12, 2005 11:14 am

code to strip message header?

Post by richtalbot »

Thanks Brett,

I've looked at a mail message with attachment in Notepad and can see what you mean.

Does anyone know a script or easy way to strip the attachments to individual mail files?

Regards, Rich

PS. I am trying to allow spam messages to be sent as attachments from a genuine user to spam@ so that the attachments can be extracted and copied to the spam@ folder ready for spam auto-learning.

johnd34
Posts: 73
Joined: Thu Jul 29, 2004 10:43 am
Location: UK

Post by johnd34 »

You need to be able to read the S/MIME format. Look this up in your language of choice. :)

On my server i am currently using perl, after finding it better supported than VB, (And maybe faster? ) to catch messages in the MTA.

I use the MIME decode and mime read functions and literally take the messages apart complelty, then rebuild them into a template to look nicer !

You can then extract files and write them to disk !

i am just BETA testing an option to grab large attachements out of the SMTP to stop them clogging clients email, then allow them to download from a web page. Maybe I should release this as a seperate app :roll:
John D
JD Projects

Developer of E-Mailing Systems
West of England
Check out our email service built on mailenable
www.proserviceemail.co.uk
www.jdprojects.co.uk
www.smarterweb.co.uk

richtalbot
Posts: 7
Joined: Mon Dec 12, 2005 11:14 am

Post by richtalbot »

Is there any way to do this in MailEnable (built in) or do I have to use a programming language such as perl, vb, .net etc.?

Or can a filter do this task? eg. 'anything sent to spam@, forward the attachments to spamprocess@'

oakleeman
Posts: 19
Joined: Tue Nov 23, 2004 6:48 am

Post by oakleeman »

Does anybody have some sample code that could be used for this? I'd like to use the catch-all feature to implement an automatic document scanner server that can export the attachments to a folder based upon the recipient e-mail address.

For example:

1. Scanned pdf file is e-mailed to 01295@domain.com
2. PDF file is exported from e-mail to D:\elig_docs\01295\datescanned_01295.pdf
3. Email is deleted

Don't care if this is done via DOS, vbscript, or MTA.

johnd34
Posts: 73
Joined: Thu Jul 29, 2004 10:43 am
Location: UK

Post by johnd34 »

You need to put an app in the MTA and catch the emails while they are in the queue.

I write in coldfusion but still use php to work on file while in the MTA.

standard PHP supports the mime operation to extract emails and then the file options to copy the collected part to whatever directory.

what are you using to get the scanned apps into an email first?
John D
JD Projects

Developer of E-Mailing Systems
West of England
Check out our email service built on mailenable
www.proserviceemail.co.uk
www.jdprojects.co.uk
www.smarterweb.co.uk

oakleeman
Posts: 19
Joined: Tue Nov 23, 2004 6:48 am

Post by oakleeman »

I'll be using our copy machine. It can scan documents into PDF format and then e-mail them as attachments to a pre-defined e-mail address or an e-mail address you manually enter when you are scanning.

I was hoping to just use a WinXP VM for MailEnable and then have a batch file process the e-mail and copy the attachment to our main file server. I would prefer not to have to work with PHP, perl, etc. if possible but am willing to if that is the only way.

Post Reply