Attachment as message/rfc822

Junior Member
User avatar
Posts: 39
Joined: Thu Nov 15, 2007 12:37 pm

Attachment as message/rfc822

Postby jheyne » Wed May 23, 2012 8:38 am

Hello,
i have this script:
Code: Select all
If <something>
var saveEMLpath = <thePath>;
var ext = 'eml';
msg.saveToFile(saveEMLpath + msg.header['Subject'] + ext);

--> that works fine!
The next step is to attach the saved file to a new Mail:
Code: Select all
   m = new TMsg;
   m.attachFile(saveEMLpath + msg.header['Subject'] + ext);
   send(m, msg.header['from'], msg.header['to']);
   m.free();

--> that works fine, too.
BUT:
The Content-Type of the attachment is ever: Content-Type: application/octet-stream
I can see that when i open the received mail with e.g. notepad.

I need the possibility the change the Content-Type of the attachment to the right one (message/rfc822).

How can i do that?
Regards
Joerg

Developer
User avatar
Posts: 4431
Joined: Tue Apr 20, 2004 3:43 pm

Postby Alexander Telegin » Wed May 23, 2012 7:07 pm

Joerg, after m.attachFile try to change the content type using this:

Code: Select all
var attach = m.parts[ m.parts.count-1 ];
attach.header.fields['Content-Type'] = 'message/rfc822; name="attach.eml"';

Return to Filters and scripts

Who is online

Users browsing this forum: No registered users and 0 guests