How to Send Attractive Emails Using Email Templates

This sample demonstrates how to send attractive emails using email templates.

File EmailTemplate.eml used in this sample is located in the folder:

    C:\Program Files\CodeSegment\SMS Studio\Samples\EmailConnection

In this example, the email template is used to compose an email message where parameters in the template (%P1%, %P2%...) are replaced with actual values before sending. As a result, the recipient receives the email message that looks like this:

Dear Customer,

We wish to inform you that your account balance has been updated.

Customer ID: C123
Account ID: A456
Account balance: 100

Should you have any questions or need further assistance, feel free to contact us.

Best regards,
Company Name

You can use Outlook Express to create email templates. Select the File / New / Mail Message option and when you finish creating your message, select the File / Save As option in the New Message window. To edit a saved template, double-click on the file and it will be opened in the Message window, remember to use the File / Save As option to save it again to the same file.

Setup Email connection

  1. In the Connections window click the Add button and select the Email connection from the list of available connection types.
  2. In the Options tab of the Add Email Connection dialog enter the following parameters:
    Session type: Transmit only
  3. In the Login tab enter your email account credentials.
  4. In the Send tab enter your email server options.
  5. In the Compose tab enter the following parameters:
    Sender: MY@EMAIL.COM
    Recipient: %To%
    Compose type: Advanced
  6. Click the OK button to close the Add Email Connection dialog.
  7. Click the Connect button to connect the Email connection.

Send email message

  1. Use Tools / Send Message option in the main menu to display the Send Message dialog.
  2. Enter the following parameters:
    Phone: RECIPIENT@EMAIL.COM
    Text: EmailTemplate.eml|C123|A456|100
    Account: Use the selection button ( ... ) to select the Email account created above.
  3. Click the Send button and check the Outbox window to see if the message is being sent.

Source code

The contents of the EmailTemplate.eml file:

Subject: Email Template Sample
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000_0043_01C9E803.DDF4BE80"
X-Unsent: 1

This is a multi-part message in MIME format.

------=_NextPart_000_0043_01C9E803.DDF4BE80
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear Customer,

We wish to inform you that your account balance has been updated.

Customer ID: %P1%
Account ID: %P2%
Account balance: %P3%

Should you have any questions or need further assistance, feel free to contact us.

Best regards,
Company Name

------=_NextPart_000_0043_01C9E803.DDF4BE80
Content-Type: text/html;charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<HTML><HEAD>
<STYLE></STYLE>
</HEAD>
<BODY><FONT face=3DArial size=3D2>
Dear Customer,<BR>
<BR>
We wish to inform you that your account balance has been updated.<BR>
<BR>
<STRONG>Customer ID:</STRONG> %P1%<BR>
<STRONG>Account ID:</STRONG> %P2%<BR>
<STRONG>Account balance:</STRONG> %P3%<BR>
<BR>
Should you have any questions or need further assistance, feel free to contact us.<BR>
<BR>
Best regards,<BR>
Company Name<BR>
</FONT></BODY></HTML>

------=_NextPart_000_0043_01C9E803.DDF4BE80--

Related topics

Email Connection

 

Copyright © 2002-2010 CodeSegment. All rights reserved.

   www.codesegment.com