РУС Site Map Contact Us Home
E-mail Newsletter
Subscribe to get informed about
Clever Components news.

Your Name:
Your Email:
 
SUBSCRIBE
 
Previous Newsletters
 




Products Articles Downloads Order Support
Customer Portal   

Create 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!', '');
clMailMessage.From.Email := 'john @ domain.com';
clMailMessage.ToList.Add('steve @ another.com');
clMailMessage.Subject := 'Hello';
messageSource := clMailMessage.MessageSource;

This method creates new email in Plain Text format:

Show Message Source

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

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

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

    Copyright © 2000-2017