Skip to main content
Known Participant
April 23, 2009
Question

How to trim blank line from top of CFMAIL email?

  • April 23, 2009
  • 1 reply
  • 872 views

Hi,

I'm using cfmail to send simple plain text email.  Length is an issue, and my available length is being affected by the blank line that cfmail inserts at the top of every email.

This has never bothered me before, but this time, some messages are being truncated by the receiving devices because of this blank line at the top.

Does anyone know how to remove this blank line at the top of the email?  I don't care about the one at the bottom.

I've googled for this with no luck.  I tried using cfsavecontent to create the content and then trim it.  No luck.  Can it be done?

Thanks,

Joe

    This topic has been closed for replies.

    1 reply

    Participant
    April 23, 2009

    Can you please paste your source code here.

    Known Participant
    April 23, 2009

    Generating content here:

    <cfsavecontent
        variable = "notification">
    <cfoutput>#rs_packageCustomer.first_name#</cfoutput> <cfoutput>#rs_packageCustomer.last_name#</cfoutput> has received a new <cfoutput>#session.package_received_carrier#</cfoutput> package at <cfoutput>#Session.storename#</cfoutput>. <cfoutput>#form.custommessage#</cfoutput>
    </cfsavecontent>

    Trying to trim it here (I know, multiple steps, I was breaking everything down separately to troubleshoot):

    <cfset notification=trim(variables.notification)>

    Then sending notification (some values changed since we're posting publicly)

    <cfif ("#rs_pc.email#") NEQ "" >

    <cfmail to="#variables.decrypted_email#"
    replyto="noreply@blah.com"
    failto="blah@blah.net"
    from="#Session.storename#<noreply@blah.com>"
    subject="New #session.prc# package at #Session.storename#">#variables.notification#
    </cfmail>
       </cfif>

    Thanks for any ideas...

    Inspiring
    April 23, 2009

    You might try using CFMAILPART to add the body of your mail message.  Ben Nadel's blog contains a sample that uses this method.  Disclaimer: I've never used this method myself.

    http://www.bennadel.com/blog/692-Sending-Text-Messages-SMS-With-ColdFusion-And-CFMail.htm