Just upgraded to 7.x-1.4 from 1.3 and noticed the "From Name" configured in my SMTP Authentication Support admin page ("E-mail from name") no longer appears in emails I'm sending. It looks like there's been some mucking with the From_Name in a few places since 1.3.
Looks like this is the busted part:
$properfrom = variable_get('site_mail', '');
if (!empty($properfrom)) {
$headers['From'] = $properfrom;
//$from = $properfrom;
}
I was able to get the "From Name" to reappear by commenting out: "$from = $properfrom;" at line ~127 in smtp/smtp.mail.inc ... not sure if that line is itself a bug, or the "bug" is not setting from_name prior to or after that line.
Comments
Comment #2
mmikitka commented+1. Also observing this and I am confirming that the workaround suffices.
Comment #3
dang42 commentedI haven't tried the workaround, but the From Name definitely isn't being displayed. I get the site email address instead.
Comment #4
mrpeanut commentedI have the same issue. The workaround works without any apparent issues.
Comment #5
dang42 commentedI've created a patch that removes the one line noted in the description by eggersrj. I too cannot tell if this line is necessary for some other purpose, but removing it does replace the email address with the desired "From Name" in the From column of my email client.
Comment #6
damienmckennaI suggest adding tests to confirm the field works as intended.
Comment #7
blart commentedPlease look also at parent issue: https://www.drupal.org/node/2309875
Comment #8
etienne-ttb commentedI tried both: comment out the line or delete it, but I still have the issue.
I also tried the 7.x-1.4+7-dev version but I stil have the full email adress instead of the desired Name.
Comment #9
laborouge commentedSame bug for me. subscribe
Comment #10
redsky commentedI have the same issue, subscribe
Comment #11
dczaretsky commentedI'm experiencing the same issue after upgrading.
After further investigation, I believe the root cause is at line ~143:
$from_comp = $this->_get_components($from);This function parses the $from email address, expecting the format "<full name> email@example.com". It doesn't find the <full name> and so the 'name' field is left empty. I'm not sure under what circumstances the full name would have been place there in the first place, but the simple solution would be to check if 'name' field is empty and assign $from_name. Here is the code:
Worked fine for me.
Comment #12
nachus commented#11 worked for me too! thanks!!
Comment #13
shubhraprakash commentedThe problem is there at two places in version 1.4.
Line 122 of smtp.mail.inc - Should be updated to:
$properfrom = variable_get('smtp_from', '');Line 155 of smtp.mail.inc - Should be updated to:
((isset($from_comp['name'])) && ( $from_comp['name'] != '' )) ? $from_comp['name'] : $from_name;Comment #14
jeffm2001 commented#13 seems to work for me. Here is a patch.
Comment #15
jeffm2001 commentedSorry, changed the wrong line in the previous patch.
Comment #16
waluyo.umam commentedI modified the code following patch #15 and it works. Please commit/release it so easier for others to update.
Comment #17
alexxsur commentedI modified the code following patch #15 too and it works, Thanks! I agree with the previous comment, please commit/release it so easier for others to update.
Comment #18
zekvyrin commentedI can confirm that it's working as it should & code seems good.
I'm marking it as RTBC.
Comment #19
jbratu commentedSame bug for me. subscribe. #5 and #15 fixed the issue for me.
Comment #21
wundo commentedComment #23
holtzman commentedI've had to reapply this patch in 1.6 and 1.7. Am I missing something?
Comment #24
jds1@holtzman – you are not missing anything. I just had to reapply #5 in 1.7 to get this to work. It seems like #15 was applied but #5 wasn't. A maintainer should reroll this into the dev branch so it is included for the next release.
Comment #25
anthonyroundtree commentedIt appears #5 was never rerolled into 1.7. Is it in the dev version? Is it relevant?
I'm having the same issue where the From value set in smtp is not displayed properly, but also when I try to set the value via a webform component, it is being ignored. When I reply to the email, I see that the Reply-To header is being used, but the incoming email itself does not display webform values.
Should this be re-opened or is this an unrelated topic?