#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2008
    Posts
    29
    Rep Power
    0

    How to add HTML code to format in CFMAIL


    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.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    971
    Just use type="html". You can check the docs for full details.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2005
    Posts
    349
    Rep Power
    0
    <CFMAIL TO = "test@test.com"
    FROM = "test@test.com"
    SUBJECT = "test"
    type="html"
    >
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2007
    Posts
    3
    Rep Power
    0

    RE: adding HTML to CFMAIL


    one thing to think about when sending HTML code via CFMAIL is that you will need to use inline styling rather than referencing a CSS file reason being is MS Outlook alot of times does not like CSS files especially if your email gets forwarded, hence your HTML layout can get messed up so to use inline styling with your HTML is a good standard to use that way if your HTML email gets forwarded it looks consistent.

    EX:
    <table border="0" cellpadding="0" cellspacing="0" style="width:100%; font-family:Arial, Helvetica, sans-serif;">
    <tr>
    <td></td>
    </tr>
    </table>
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2008
    Posts
    11
    Rep Power
    0
    If this is for business use and not a spam bot.. be sure to override the default CF mail header...

    <cfsilent>
    <cfmailparam name="X-MimeOLE" value="Produced By Microsoft Exchange V6.5.7226.0">
    <cfmailparam name="X-MS-Has-Attach" value="yes">
    <cfmailparam name="X-MS-TNEF-Correlator" value="">
    <cfmailparam name="Content-class" value="urn">
    <cfmailparam name="content-classes" value="message">
    <!---- if you have attachments add them in too---->
    <cfif len(arguments.messagebean.getAttachment_1())>
    <cfmailparam file="#attachment_local_file_1#">
    </cfif>

    </cfsilent>

    Many mail services bounce CF generated mail's now.
    good luck

IMN logo majestic logo threadwatch logo seochat tools logo