Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Commas in "From" Name
  • Vote Up0Vote Down migordonmigordon
    Posts: 3Sendy user

    I notice that Sendy can't have commas in the "From" name. Is there any workaround for this? E-mails need to appear as if they were sent by our users from their own clients as opposed to in bulk, and that appears Last, First based on our e-mail server setup. This doesn't seem to be an Amazon SES limitation because I've used other SES products that support this. If it is an SES limitation, can I workaround it by using an SMTP server?

  • 4 Comments
  • Vote Up0Vote Down BenBen
    Posts: 3,484Sendy support

    Hi Michael,

    When you have a comma in the 'from name', Amazon rejects the email with a 400 error saying "InvalidParameterValue - Local address contains control or whitespace".

    I'll see what I can do with this. Maybe by adding quotes around the 'From name'.

    Thanks.

    Ben

  • Vote Up0Vote Down migordonmigordon
    Posts: 3Sendy user

    I commented out your code that checks for commas in the "From" name (lines 181 and 182 in edit.php and lines 118 and 119 in create.php), then manually enclosed my From name in double-quotes. Amazon happily sent it, both a test and a test campaign, so what you said appears to be one way to make it work! Single-quotes do not seem to work, nor does escaping the comma without quotes (i.e. Last\, First); Sendy appears to strip my escape character.

    Unfortunately, the "From" appears in the recipient user's client with quotes in it. Somehow, SESMailer manages to use SES to send e-mails with commas in the "From" name appear in the recipient's client without quotes around the sender name. While I'm looking at the code a bit to see if I see something obvious, I'm not a developer or an AWS expert, so I'm not sure how much help I can be. I'm happy to test anything out if it would help you troubleshoot.

  • Vote Up0Vote Down migordonmigordon
    Posts: 3Sendy user

    This appears to be a bug in the Amazon SES implementation in PHPMailer. It doesn't enclose the "From" name in quotes, as required by the MIME standard if you want to use any of certain characters in a MIME parameter value. See, e.g., RFC 2045 at 12.

    I managed a workaround. First, comment out the lines described in my previous message. Next make line 664 of includes/helpers/class.phpmailer.php read as follows:

    "\"{$addr_ar[1]}\" <{$addr_ar[0]}>" : $addr_ar[0];' //internal escaped quotes added by migordon

    As the comment says, this adds internal escaped quotes around the "From" name part of the address. When entering the "From" name in Sendy, do not include quotes. Amazon SES will send the e-mail, and the results are as expected (no quotation marks around the "From" name when clients receive it).

    Of course, please check what I'm doing before you deploy any fixes to make sure I'm not doing something crazy (I'm a lawyer, not a developer). And also before deployment, the new-brand and edit-brand pages need to have similar fixes to the edit and create pages to allow them to accept commas in the "From name" field again.

    EDIT: I found two other files that have to be changed if you modify PHPMailer.

    Make line 55 in includes/campaigns/bounces.php and line 54 in includes/campaigns/complaints read as follows:

    $from_email = str_replace(array('"Sendy" <', '>'), '', $from_email);//double quotes added by migordon

    Otherwise the parsing of the from e-mail in bounces and complaints is incorrect, and you'll never get verification of bounces or complaints working. (I think they'll still work anyway.)

  • Vote Up0Vote Down BenBen
    Posts: 3,484Sendy support

    This is now fixed in version 1.1.7. Thanks Michael!

This discussion has been closed.
All Discussions