[Mimedefang] Altering mail attachment using Mime defang

Jonas Eckerman jonas_lists at frukt.org
Fri Dec 21 07:02:55 EST 2007


vinita batra wrote:

> There is some policy and according to that if mail attachment contains
> ms word file , then i need to replace that ms word attchment with new
> ms word file.

> so can you please give me some piece of code that can replace the mail
> attachment(ms word file) with newer attachment(new ms word file).

> I am using send mail server.
> and i want to use MimeDefang for this purpose.

Is there any special reason why you want to do this with MIMEDefang?

Since MIMEDefang processes the mail during the SMTP conversation, 
it is a good idea to avoid lengthy processes that don't have an 
impact on the SMTP conversation.

Unless your document replacing needs to be done during the SMTP 
conversation I would suggest that you do it after the mail has 
allready been received, wich means not doing it with MIMEDefang.

If you use a Unix-like system, the first place that comes to mind 
for this would be your local MDA. You could simply pipe all 
messages through a perl MDA that does what you want.

You could still use MIMEDefang in order to determine wich mails 
has to be sent though this process if that works better. Maybe 
somethinbg like this:

MIMEDefang checks all attachments (in the "filter" callback). If 
there is a word document that needs to be replaced, MIMEDEfang 
reroutes the message (to another address or maybe to a 
file/queue). If rerouting to addresses, those could contain the 
original recipient addresses (maybe usi8ng a + delimiter in the 
local part if your mail server likes that).

A program completely separate from MIMEDefang could then process 
those messages, replace the document, and deliver them or 
reinsert them into the mail stream (making sure MIMEdefang 
doesn't decide to reroute them again!).

Regards
/Jonas

-- 
Jonas Eckerman, FSDB & Fruktträdet
http://whatever.frukt.org/
http://www.fsdb.org/
http://www.frukt.org/




More information about the MIMEDefang mailing list