Question

How can I use cfmail to send an email to an address that has a single quote in it? For example:

firstname.o'flanagan@example.com

For some reason I can't get an email sent to that address no matter what I do. Here's the cfmail tag code I'm using. I've tested all the variables and they're all defined:

<cfmail from="#getEmail.from_email#" 
        to="#email#" 
        subject="#getEmail.subject#" 
        type="HTML" 
        cc="#cc_email#" 
        bcc="#attributes.bcc_email#" 
        charset="UTF-8">

Am I missing something? Thanks for the help.

Was it helpful?

Solution

Did you try

<cfmail from="#getEmail.from_email#"
 to="#preserveSingleQuotes(email)#" 
 subject="#getEmail.subject#" type="HTML" 
  cc="#cc_email#" bcc="#attributes.bcc_email#" charset="UTF-8">

using the PreserveSingleQuotes should allow you to send to that address. Unfortunately using a single quote is valid in an email.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top