Variables


"Replacing variables" in email body or header is the most important feature of EASendMail service.

Common Variables

{$var_rcpt}, {$var_rcptname} and {$var_rcptaddr} are the most common variables used in EASendMail services. For example: The component (ANSMTP or EASendMail) sends an email to "Tester <test@adminsystem.com>". The recipient name is "Tester" and address is <test@adminsystem.com>.

If the email body text is: "Dear {$var_rcptname}, your email is {$var_rcptaddr}, full address is {$var_rcpt}".
Then the recipient will recive the following body text:
Dear Tester, your email is test@adminsystem.com, full address is Tester <test@adminsystem.com>

This is very useful to newsletter application. The component can send one email to EASendMail service with hundreds of recipients, EASendMail service will replace those variables automatically and delivery the email to every recipient.

Database Variables

If the component sends the email by database select. The following variables can be used.

{$var_srecord:[fieldname]} fetches a value by the table field name. For example, the component specifies the "X-Sql-Select: SELECT userid, name, email from usertable". And recipient email address is stored in email field, then the component should set the To as "{$var_srecord:email}", EASendMail service will delivery the email to every recipient in usertable. The {$var_srecord:[fieldname]} can be used in body text and subject as well. For example: the body text can be: Dear {$var_srecord:name}, your id is {$var_srecord:userid}.

{$var_irecord:[fieldindex]} fetches a value by the table field sequence index. For example, the component specifies the "X-Sql-Select: SELECT userid, name, email from usertable". And recipient email address is stored in email field, then the component should set the To as "{$var_irecord:2}", EASendMail service will delivery the email to every recipient in usertable. The {$var_irecord:[fieldname]} can be used in body text and subject as well. For example: the body text can be: Dear {$var_irecord:1}, your id is {$var_irecord:0}.

Result Variables

If the component specifies X-Sql-OnSuccess or X-Sql-OnError, the following variables are aviable. {$var_errcode}: Error code returned by SMTP server or System. {$var_errdesc}: Error description {$var_server}: Current SMTP server address.

To learn more about usage of the variables, please refer to ANSMTP or EASendMail samples.

See Also

Disclaimer Installation  Configuration  Journal and troubleshooting