Download & Extend

E-mail from name: is not taking name with spaces

Project:SMTP Authentication Support
Version:6.x-1.0-beta5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

I am able to send mail.
I have smtp-6.x-1.0-beta5 with PHPMailer 5.0 on my system.

In configuration I set E-mail from name: SMTP Mail

However at receiving end I am getting only SMTP as from name.

Please help

Comments

#1

Are you using Webform? I've begun to notice the same thing where Webform (both 6.x-2.x and 6.x-3.x) submission "from" is cut off, but regular Drupal actions (update notices, SMTP tests) are sending correctly with the full name.

Also, please note that the project page states that PHPMailer versions higher than 2.2.1 are not supported. I'm not sure that this is the cause of the problem, as my sites are running different versions from 2.3 to 5.1, so I'm going to get that fixed.

#2

Category:support request» bug report
Status:active» needs review

Are you using Simplenews? I'm having the same problem, and wondering if Simplenews is formatting the From address before sending. In smtp_drupal_mail_wrapper(), $message['from'] comes in as:

"Information Mailing" <info@example.com>

I modified the regex in the preg_replace() to use "\t\n" instead of "\s". This will still catch tabs and newlines, but allow spaces.

AttachmentSize
smtp-888856-2.patch 886 bytes

#3

Just applied the patch. Works great. Thanks!

I also had a problem with webform. When the last name had spaces, for example "Van der Voort", I received a mail from "Van". With the patch it is from "Van der Voort".

#4

I used a slightly different approach to fix this issue.

AttachmentSize
smtp-888856-4_0.patch 868 bytes

#5

Jaesin: can you explain the logic there? I haven't testing this, but I'm wondering if it would work correctly even if no from name is specified.

By way of example, if you only specify a from address with no name, would the value be:

info@example.com

or

"info@example.com" <info@example.com>

I think this last patch will only work with the second one.

#6

I was having the same issue using the webform module - the from name was cutting off anything after a space.

Patch in #2 helped, thanks BrockBoland.

Pete

#7

#2 patch fixed it for us too. Thank you.

#8

We created another different patch which fixes the issue for us. Thought I'd throw it in the mix.

AttachmentSize
smtp-888856-8.patch 668 bytes

#9

#2 does it, and here's a modern git version of the patch

AttachmentSize
smtp-888856-9.patch 677 bytes