Create MIME encoded e-mail data

[Top]  [Chapter]  [Previous]  [Next]

The integrated MIME writer class can be used to create MIME formatted data:

 

If you use the method SaveToString with the format name "MIME" it will create multipart MIME e-mail data with the HTML code and all images embedded without a single temporary file being created!

 

A MIME message will be also written when the document is saved to a *.MSG file.

 

Example MIME Ouput Data:

 

From: Me@somewhere.com

To: somebody@somewhere.com

Subject: Test me

Date: Fri, 17 Nov 2006 09:00:29 +0100

CC: "Julian"<julian@somewhere.com>

MIME-Version: 1.0 (produced by Synapse)

X-mailer: WPTools/TextDynamic

Content-type: Multipart/mixed; boundary="00010001_1855D7EE_MIME_Boundary"

Content-Description: Multipart message

 

--00010001_1855D7EE_MIME_Boundary

Content-type: text/html; charset=UTF-8

Content-Transfer-Encoding: Quoted-printable

Content-Disposition: inline

Content-Description: Message text

 

=EF=BB=BF<html>

<head></head><body>

<div><font face=3D"Arial">Some Text</font></div>

<div><font face=3D"Arial">and an image: <img src=3D"CID000100000001" style=

=3D"width:0.23in;height:0.17in;"/></font></div>

</body></html>

--00010001_1855D7EE_MIME_Boundary

 

--00010001_1855D7EE_MIME_Boundary

Content-type: text/plain; charset=ISO-8859-1

Content-Transfer-Encoding: Quoted-printable

Content-Disposition: inline

Content-Description: Message text

 

Some Text

and an image: [image1.JPEG]

--00010001_1855D7EE_MIME_Boundary

Content-type: image/JPEG; name="image1.JPEG"

Content-Transfer-Encoding: Base64

Content-ID: CID000100000001

Content-Disposition: inline; FileName="image1.JPEG"

Content-Description: Included file: image1.JPEG

 

/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoM

DAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsN

FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAAR

CAAUABsDASIAAhEBAxEB/8QAHwAAAQUBA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1855D7EE_MIME_Boundary--

 

The following format options can be used:

 

-noplain : Do not include the plain text

-nohtml : Do not include the text as HTML code. Embedded images will be still appended to the mail data.

 

In the plain text always placeholders for the images will be inserted, see the text "[image1.JPEG]" in the MIME example above.

 

Example:

 html_mail = SaveToString(false, "MIME-noplain,")

 

The e-mail properties

Form, To, Subject, and CC will be set to the values assigned to the property MAPI!

 

The MIME writer uses functions of the free library Synapse at http://www.ararat.cz/synapse/        

 

 

 


[mime.htm]    Copyright © 2007 by WPCubed GmbH