• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Step 7. Using Email with ColdFusion MX > Sending HTML-Based Email

Sending HTML-Based Email

As we saw in Example 7.1: Creating a Web-Based Email Form, <CFMAIL> will send its message body as plain text by default. However, there might be times when you want to send email in HTML format. Perhaps your company likes to email all employees a monthly newsletter, for example, or email all customers a regular product specials page outlining the latest sale items. You could email these things as plain text, but sending them in HTML format gives them a bit more punch and presents a slicker look and feel.

We can send HTML email using the <CFMAIL> tag simply by including the TYPE attribute in our opening <CFMAIL> tag and setting its value to "HTML". With the TYPE attribute set to "HTML", you simply add HTML tags to the message body between the opening and closing <CFMAIL> tags. The HTML you use should be well structured, so do not forget to include the <HTML> and <BODY> tags within the email message body. The following code illustrates the use of <CFMAIL> to send HTML email:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint