BackUp LevelNext

Sending Email Messages (SMTP)

Before you set up ColdFusion to send email messages, you must have access to an SMTP email server. Also, before you run application pages that refer to the email server, you must configure the ColdFusion Administrator to use the SMTP server.

To configure ColdFusion for email:

  1. Open the Mail page in the ColdFusion Administrator.
  2. In the Mail Server box, enter the address of the SMTP mail server you want ColdFusion to use.
  3. Leave the Server Port and Connection Timeout settings at their default values.
  4. Click Apply to save the settings.
  5. To verify server settings, click the Verify button to make sure ColdFusion can access your mail server.

See the Administering ColdFusion Server book for more information on the Administrator's mail settings.

Sending SMTP mail with CFMAIL

The CFMAIL tag provides support for sending SMTP (Simple Mail Transfer Protocol) email from within ColdFusion applications. The CFMAIL tag is similar to the CFOUTPUT tag, except that CFMAIL outputs the generated text as SMTP mail messages rather than to the display screen. All attributes and commands you use with CFOUTPUT you can also use with CFMAIL.

Here's an example of a basic use of the CFMAIL tag, using form variables to resolve the From, To, Subject, and message body components of the mail message.

<CFMAIL QUERY="GetList"
    TO="#Email#"
    FROM="Sales DepartmentList Manager"
    SUBJECT="#Form.Subject#">

    #FORM.Body#

</CFMAIL>

More detailed examples follow in subsequent sections. Also, see the CFML Language Reference for a full catalog of the CFMAIL tag's attributes and values.


BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.