How to add HTML code to format in CFMAIL

Discussion in 'Programming' started by jennypretty, Aug 14, 2008.

  1. #1
    Hello,
    I am a newbie to CFMAIL and like to ask if there is a way to format the output within CFMAIL. I tried to enter HTML code within CFMAIL and I got the html code from output.

    I created a simple comments form for users to submit their comments, and send this result to my email.

    Here is my code:

    <CFMAIL TO = "test@test.com"
    FROM = "test@test.com"
    SUBJECT = "test"
    >

    New suggestions: <br />
    <b>Name:</b> #name#
    <b>Comments:</b> #comments#
    </CFMAIL>

    On the output, I received all html code and when a user enter multiple rows of suggestions, they are not aligned properly in the email.

    How do I format the output within cfmail?
    How do I get good format for the comments with multiple rows?

    Thanks very much.

    Jenny.
     
    jennypretty, Aug 14, 2008 IP
  2. unitedlocalbands

    unitedlocalbands Well-Known Member

    Messages:
    246
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    #2
    First you need to set the type attribute as text/html in your cfmail tag.

    Then you can put any html you would like to format your email message.

    
    <CFMAIL TO = "test@test.com" 
    FROM = "test@test.com" 
    SUBJECT = "test" [COLOR="DarkRed"]type="text/html"[/COLOR]
    > 
    
    New suggestions: <br />
    <b>Name:</b> #name#
    <b>Comments:</b> #comments#
    </CFMAIL> 
    
    Code (markup):
     
    unitedlocalbands, Aug 14, 2008 IP