How to send mail using Coldfusion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    How to send mail using Coldfusion

    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:
    [CODE=cfm]<cfmail
    to="recipient"
    from="sender"
    subject="msg_su bject"
    cc="copy_to"
    bcc="blind_copy _to">[/CODE]
    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:[code=cfm]<cfmail
    to="someone@exa mple.com"
    from="me@compan y.com"
    subject="Test Email">
    This is a test email.
    </cfmail>[/code]
    We will deal with more advanced examples and uses of the cfmail tag later.
  • bushnellweb
    New Member
    • Jan 2010
    • 48

    #2
    you know what would be helpful, some code that tests it for failure. Is there anything out there that would do that?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Yes, use cftry/cfcatch.

      Comment

      Working...