The SMTP module is replacing the name area of the "From" portion of the email, even if the setting is filled out.

I'm using user_mail and I set the "from" portion (ex. "Jacob Redding ") but the email goes out "Website Submission

How do I prevent this?

Comments

LukeLast’s picture

I'm not exactly sure what "from" portion you are referring too. Are you adding From: "Jacob Redding" <user@example.com> to the header?

That is the only way to get a "from name" through the function.

Christoph C. Cemper’s picture

sames troubles here

Christoph C. Cemper’s picture

Well, after setting $SMTPDebug = 2
I see the problem is, that
if the header has a

"myfirst mylast4" <blabla@bla.com>

in there it in fact does talk to the SMTP and passes in


<"myfirst mylast4" <blabla@bla.com>>

and we get an

SMTP -> ERROR: MAIL not accepted from server: 501 <"myfirst mylast4"
>: "@" or "." expected after ""myfirst mylast4""
SMTP -> FROM SERVER
:

This MUST fail.

Now that I understand that smtp.module parses the headers falsly,
I understand the reason for this weird setting called "E-mail from Name:"
which overrides all From-Names with the Site-Name or some hardcoded crap from that parameter...

now that's what I call symptom-fixing-becauseof-lackofdebuggingskills

Christoph C. Cemper’s picture

still trying to find out if this 4.7.x problem was fixed in the HEAD versions

Christoph C. Cemper’s picture

Ok, that required me some debugging.

There was some dead code in the module, where it should actually handle addresses of that sytnax,
and it appears trailing characters (like space or \n or \r) made the reg'ex fail

I simply added a (.*) to the regex so changing

$regexp="/^From: (.*) <([a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,})>$/i"

to

$regexp="/^From: (.*) <([a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,})>(.*)$/i"

and it worked by just capturing the stuff behind the last > into a variable we never use...

Christoph C. Cemper’s picture

Category: support » bug
Status: Active » Needs review
scott.mclewin’s picture

We appear to be chasing down similar problems but with differing solutions. I too get the badly formatted from header, but I resolved it differently.

http://drupal.org/node/195622

Which do you think is more appropriate? Or are they solving two truly independent problems?

oadaeh’s picture

Status: Needs review » Active

Code in the comment does not qualify as a patch. See http://drupal.org/patch for more information.

Edit: I should mention that I will be working on correcting this, so sending a patch is not necessary.

oadaeh’s picture

Status: Active » Fixed

The fix for the from field problem has been committed here: http://drupal.org/cvs?commit=90638

I'm not sure if this corrects the problem Christoph C. Cemper is having, so if it doesn't please open a new issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.