"Name" <email@example.com> FROM name fails

goose2000 - July 8, 2008 - 12:54
Project:SMTP Authentication Support
Version:6.x-1.0-beta3
Component:Code
Category:bug report
Priority:normal
Assigned:oadaeh
Status:active
Description

Hi, my development site is running on IIS with SMTP server. Mail is working fine when creating new users or getting a password reset. I have built a webform and upon submitting I'll get this error:

    * warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in C:\Inetpub\wwwroot\BHI_dev\includes\mail.inc on line 193.
    * Unable to send e-mail. Please contact the site admin, if the problem persists.

The address I use in my testing are in fact completely valid. Seems like webform is not playing nice with the core somehow. Further ideas?

Using Drupal 6.2.

Thanks.

#1

goose2000 - July 8, 2008 - 14:03
Priority:critical» minor

This seems to be an IIS SMTP issue only. See here:

http://drupal.org/node/33967

Easy work around is to have no 'name' text , just the email address when you configure webform.
Think it may still be fixable at the code? I set it to 'minor' now.

Working great, one of the best modules around.

#2

quicksketch - October 6, 2008 - 04:52
Title:Email Invalid Address» "Name" <email@example.com> FROM name fails
Project:Webform» SMTP Authentication Support
Version:6.x-2.1.1» 6.x-1.0-beta3

Moving to the SMTP module.

To summarize, Webform users have not been able to send e-mails when using the SMTP module and the FROM e-mail addresses are formatted as "First Last" <email@example.com>. The name is properly mime_header_encoded when necessary.

Any users experiencing this issue, please update with the version of SMTP module you're using.

#3

oadaeh - October 8, 2008 - 15:35
Version:6.x-1.0-beta3» 6.x-1.x-dev
Priority:minor» normal
Assigned to:Anonymous» oadaeh

This is an FYI for all concerned parties. (This message is duplicated on the issues listed below. Read on for the why.)

I don't actually like the way the From e-mail address is handled in the code for the SMTP Authentication Support module. I have plans to change it, but because I think it will be a bit of a paradigm shift to change it so it works better and makes more sense, I was kind of waiting for my last massive changes is settle in a bit to see if they were causing anyone any problems before I potentially created more problems.

Although all the relevant issues are all pretty much duplicates of each other, there are some nuances in each that I want to capture in my work through the code. These are the relevant issues that I'll be working on together:
http://drupal.org/node/200415
http://drupal.org/node/279836
http://drupal.org/node/295655
http://drupal.org/node/300055

Just know that I will be working on these in the next month or so (sooner, if I get my current task list cleared up).

BTW, I'll be making the changes first in the 6.x branch. Once everything is settled, I'll backport them to the 5.x branch.

#4

quicksketch - October 14, 2008 - 22:11

Thanks oadaeh, I'll redirect Webform users to this particular thread, as I get duplicates of this all the time also.

#5

dmoore - November 26, 2008 - 16:04

I've found that some modules like to use the format Name <mail@mail.com> or "Name" <mail@mail.com>. Both should work, and both are accepted by mail clients, so SMTP Module shouldn't force names to be quoted.

I've had to change the following line in order to allow mails to be sent from the Messaging module
$from_name = preg_replace('/"*(.*)"*\<(.*)\>/i',   '$1', $from); // It gives: Name

This simply changes the regular expression to ensure that quotes are optional.

Hope this helps.

Btw, it would be very useful if you could enhance this module to work with frameworks such as the Messaging framework that also has a PHPMailer plugin - but alas hasn't implemented authentication.

Thanks for a great module.

#6

rfay - October 19, 2009 - 20:00
Version:6.x-1.x-dev» 6.x-1.0-beta3
Status:active» needs review

The attached patch makes a minor change to the regex to fix this issue. If you review this or use this and it helps you, please mark it as Reviewed and Tested by the Community.

AttachmentSize
smtp_module_name_patch_279836_01.patch 724 bytes

#7

liquidcms - October 19, 2009 - 19:58

pretty sure those are still wrong.. :)

try this:

$from_name = preg_replace('/"?([^("\s)]*)"?.*$/', '$1', $from); // It gives: Name

#8

liquidcms - October 19, 2009 - 20:16
Status:needs review» active

although, this still isn't handled correctly (i think by SMPT module)... as you can see in this example received email (Outlook):

http://screencast.com/t/LssiQdq5

even though the $from_name (Lifewire6) shows in email listing, it doesn't show in the actual email or when i double click to view the address: http://screencast.com/t/l5TzWzL7sijS

#9

liquidcms - October 19, 2009 - 20:25

doesn't look as though class.phpmailer.php uses the $from_name anywhere.

#10

bmoreinis - November 21, 2009 - 21:00

Patch #6 solved my problem with this error! Thank you, rfay.

#11

checkmark - November 24, 2009 - 22:31

I copied the patch from comment 6 into my smtp folder, ran

patch < path_file_name.patch

and this did NOT work for me. The "from" name has a mysterious quote on the end (but not the beginning)

#12

liquidcms - November 25, 2009 - 04:16

still pretty sure patch from #6 is wrong.

 
 

Drupal is a registered trademark of Dries Buytaert.