468,554 Members | 1,994 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

How to send mail using Coldfusion

acoder
16,027 Expert Mod 8TB
How to Send Mail in Coldfusion

You can use Coldfusion to easily send mail. From simple plain text emails to more complex HTML and multipart emails, the job is made a lot easier with Coldfusion.

In the following collection of articles, we will cover the basics and gradually move onto more useful examples including using a query to send mail to multiple recipients.

The <cfmail> tag

If you want to send email in Coldfusion, the cfmail tag is your friend.

Assuming everything is set up, the tag is very easy to use. Some of the more common attributes are given below:
Expand|Select|Wrap|Line Numbers
  1. <cfmail
  2. to="recipient"
  3. from="sender"
  4. subject="msg_subject"
  5. cc="copy_to"
  6. bcc="blind_copy_to">
Only the first three attributes are required, the rest are optional. For the full list of attributes, see the cfmail documentation. The following code demonstrates an example of this tag's use:
Expand|Select|Wrap|Line Numbers
  1. <cfmail
  2. to="someone@example.com"
  3. from="me@company.com"
  4. subject="Test Email">
  5. This is a test email.
  6. </cfmail>
We will deal with more advanced examples and uses of the cfmail tag later.
Oct 22 '07 #1
2 6526
you know what would be helpful, some code that tests it for failure. Is there anything out there that would do that?
Oct 28 '10 #2
acoder
16,027 Expert Mod 8TB
Yes, use cftry/cfcatch.
Oct 31 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

15 posts views Thread by Steve Horrillo | last post: by
6 posts views Thread by John J. Hughes II | last post: by
2 posts views Thread by am_pcguy | last post: by
4 posts views Thread by =?Utf-8?B?dHBhcmtzNjk=?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.