procmail
[Top] [All Lists]

Re: Adding text to the email body fails with attachements

2004-12-16 14:46:55
At 16:02 2004-12-16 +0000, Mark Pickell did say:
I have need to recieve emails to a particular address and add some text to the email body and forward this email to another address. Adding text to the body works out fine but when the incoming email includes an attachment the added text doesn't appear. This is a problem as all the emails are supposed to include various attachments.

Your problem is MIME boundaries, which you'd generally see as something like:

Content-Type: multipart/related;
    type="multipart/alternative";
    boundary="----=_NextPart_000_0000_915D1136.2EB09099"

(in the message headers)

------=_NextPart_000_0000_915D1136.2EB09099
Content-Type: multipart/alternative;
    boundary="----=_NextPart_001_0001_667A9167.98FDD1A0"

In the body, and note that the boundary for the NEXT part, which is different, is specified in there.

diddling with multipart MIME is generally considered beyond the scope of procmail - there's no integral MIME parser in procmail. You should use an external app (mimedecode/mimencode for instance, though certainly that's not the only option).

Be wary of simply locating a text portion and inserting your text - it may not be in the same character set encoding.

I have also just tried using the cat line without the formail and that works
to.  Any ideas why the emails with attachments fail the cat/echo.  All email
coming from Microsoft mailers.

It isn't that the cat/echo fails - it's that the added text isn't within a mime "section" and so the mailer used at the far end doesn't recognize the text which is outside of a proper mime section boundary. View the raw message (say by paging the mailbox file), and you should see it. Read the relevant RFCs. <http://www.rfcs.org/>

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>