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 may want to configure the ColdFusion Administrator to use the SMTP server so that you don't have to hard-code it in your application.
![]() |
To configure ColdFusion for email: |
See Administering ColdFusion Server or more information on the Administrator's mail settings.
The CFMAIL tag provides support for sending SMTP 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 a page. You can use all the attributes and commands that you use with CFOUTPUT with CFMAIL as well.
![]() |
To send a simple email message: |
<HTML> <HEAD> <TITLE>Sending a simple email</TITLE> </HEAD> <BODY> <H1>Sample email</H1> <CFMAIL FROM="Sender@Company.com" TO="#URL.email#" SUBJECT="Sample email" > This is a sample email to show basic email capability. </CFMAIL> The email was sent. </BODY> </HTML>
sendmail.cfm
in myapps
under the Web root directory.
http://localhost/myapps/sendmail.cfm?email=myname@mycompany.com
The template sends the email to you, through your SMTP server.