Site Map Email Us Home
 
All Products
Clever Internet Suite
Clever Internet .NET Suite
Clever Internet ActiveX Suite
Clever Keyboard Indicator
Database Comparer
Database Comparer VCL
Database Comparer ActiveX
Interbase DataPump
Subscribe and receive email notifications on all major releases and other important events.
Your Name:
Your Email:
 
Latest News

Best Offer for Delphi / C++ Builder Developers

 

Buy FIBPlus at discount price !

 
 
Products Articles Downloads Order Support
Components  | Samples  | FAQ  | Download  | Order  | History 
 

Build New Mail Message

The Mail Message component allows easy creation of the mail messages in any formats using either a Text or HTML message source or both and also support file Attachments and Images linked to the HTML part of the message.

Overload list for the BuildMessage method allows you specifying pretty much of all possible combinations of input parameters.

Example 1

If you call to the BuildMessage method with a non-empty AText parameter only, a simgle message with one body part will be generated.

clMailMessage.BuildMessage('Hello World!', '');
messageSource := clMailMessage.MessageSource;

This method creates new email in Plain Text format:

Show Message Source

From:
To:
Subject:
Date: Fri, 31 Oct 2003 7:00:22 +0300
Content-Type: multipart/mixed;
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Clever Internet Suite

Hello World!

Example 2

If you call to the BuildMessage method with both non-empty AText and AHtml parameters, a multi-part alternative message with two body parts will be generated.

clMailMessage.BuildMessage('Hello World!', '<html><body><p>Hello World!</p></body></html>');
messageSource := clMailMessage.MessageSource;

The method above creates multipart message in Rich Text (HTML) format:

Show Message Source

From:
To:
Subject:
Date: Fri, 31 Oct 2003 7:00:22 +0300
Content-Type: multipart/alternative;
   boundary="----=_NextPart_37929.3334428704.31"
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Clever Internet Suite

This is a multi-part message in MIME format.

------=_NextPart_37929.3334428704.31
Content-Type: text/plain;
   charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hello World!

------=_NextPart_37929.3334428704.31
Content-Type: text/html;
   charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<html><body><p>Hello World!</p></body></html>

------=_NextPart_37929.3334428704.31--

Example 3

If you call to the BuildMessage method with both non-empty AText and AHtml parameters where AHtml contains image including, the resulting message will be in Rich Text (HTML) format with embedded images:

clMailMessage.BuildMessage('Hello World!',
   '<html><body><p>Hello World!</p><img src="c:\pictures\icon.gif"></body></html>',
   ['c:\pictures\icon.gif'], []);
messageSource := clMailMessage.MessageSource;

As a result, the following message will be generated:

Show Message Source

From:
To:
Subject:
Date: Fri, 31 Oct 2003 7:00:22 +0300
Content-Type: multipart/related;
   type="multipart/alternative";
   boundary="----=_NextPart_37923.2275540972.31"
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Clever Internet Suite

This is a multi-part message in MIME format.

------=_NextPart_37923.2275540972.31
Content-Type: multipart/alternative;
   boundary="----=_NextPart_37923.2275540972.861"


------=_NextPart_37923.2275540972.861
Content-Type: text/plain;
   charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hello World!

------=_NextPart_37923.2275540972.861
Content-Type: text/html;
   charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<html><body><p>Hello World!</p><img src="cid:icon.gif@37923.2275540972.0"></body></html>

------=_NextPart_37923.2275540972.861--

------=_NextPart_37923.2275540972.31
Content-Type: image/gif;
   name="icon.gif"
Content-Transfer-Encoding: base64
Content-ID: <icon.gif@37923.2275540972.0>

R0lGODlhEAAQAMQWAMDAwN+QAD8/P2BgYHBwAP//T/9QAK+vr09PT/+vIFAAAAwMDL9/AH9/f29v
b/+/T1AwAODg4PDw8P+vAP///wAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BA
EAABYALAAAAAAQABAAQAVvoCWOVkVajSJWUgNBzyRPkCNFy1hRkjQEMQbiFJAJHIBexHTS8SS
VX4LhWFEAhEmhEJNBmLouDXkDQ466ZbO5YzYaCchp18MGq85WtjsA0xsyBmI0UDoSAGIMAgcRai
MBBhOKjGUkEJJDLJVrc2shADt=

------=_NextPart_37923.2275540972.31--

Example 4

With BuildMessage you can easily add any number of file attachments to all message formats mentioned above.

clMailMessage.BuildMessage('Hello World!', ['c:\archives\file1.zip', 'c:\archives\file2.zip']);
messageSource := clMailMessage.MessageSource;

This method creates new email in Plain Text format with one attached file:

Show Message Source

From:
To:
Subject: test
Date: Thu, 31 Aug 2006 14:18:28 +0400
MIME-Version: 1.0
Content-Type: multipart/mixed;
   boundary="----=_NextPart_000_000A_01C6CD08.54348B80"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Clever Internet Suite
X-MimeOLE: Clever Internet Suite

This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C6CD08.54348B80
Content-Type: text/plain;
   charset="koi8-r"
Content-Transfer-Encoding: 7bit

Letter with attachments
------=_NextPart_000_000A_01C6CD08.54348B80
Content-Type: application/octet-stream;
   name="file.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
   filename="file.zip"

UEsDBAoAAAAAAEZyHzX1c6f2BgAAAAYAAAAIAAAAZmlsZS50eHRTYW1wbGVQSwECKAAK
ch819XOn9gYAAAAGAAAACAAkAAAAAAAAACAAAAAAAAAAZmlsZS50eHQKACAAAAAAAAE
5szGASBek8LmzMYBIF6TwubMxgFQSwUGAAAAAAEAAQBaAAAALAAAAAAA

------=_NextPart_000_000A_01C6CD08.54348B80
Content-Type: application/octet-stream;
   name="file2.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
   filename="file2.zip"

ch819XOn9gYAAAAGAAAACAA50eHQKACAAAAAAAAEkAAAAAAAAACAAAAAAAAAAZmlsZS
UEsDBAoAAAAAAEZyHzX1c6f2BgAAAAYAAAAIAAAAZmlsZS50eHRTYW1wbGVQSwECKAAK

------=_NextPart_000_000A_01C6CD08.54348B80--

 
Home  | Site Map  | Products  | Articles  | Downloads  | Order  | Support
 
    Copyright © 2000-2009