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

eggersrj created an issue. See original summary.

mmikitka’s picture

+1. Also observing this and I am confirming that the workaround suffices.

dang42’s picture

I haven't tried the workaround, but the From Name definitely isn't being displayed. I get the site email address instead.

mrpeanut’s picture

I have the same issue. The workaround works without any apparent issues.

dang42’s picture

Status: Active » Needs review
StatusFileSize
new401 bytes

I'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.

damienmckenna’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Issue tags: -FROM address +Needs tests

I suggest adding tests to confirm the field works as intended.

blart’s picture

Please look also at parent issue: https://www.drupal.org/node/2309875

etienne-ttb’s picture

I 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.

laborouge’s picture

Same bug for me. subscribe

redsky’s picture

I have the same issue, subscribe

dczaretsky’s picture

I'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:

    $from_comp = $this->_get_components($from);
    if ( empty($from_comp['name']) ) $from_comp['name'] = $from_name;

Worked fine for me.

nachus’s picture

#11 worked for me too! thanks!!

shubhraprakash’s picture

The 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;

jeffm2001’s picture

StatusFileSize
new751 bytes

#13 seems to work for me. Here is a patch.

jeffm2001’s picture

StatusFileSize
new793 bytes

Sorry, changed the wrong line in the previous patch.

waluyo.umam’s picture

I modified the code following patch #15 and it works. Please commit/release it so easier for others to update.

alexxsur’s picture

I 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.

zekvyrin’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm that it's working as it should & code seems good.
I'm marking it as RTBC.

jbratu’s picture

Same bug for me. subscribe. #5 and #15 fixed the issue for me.

  • wundo committed b2842c0 on 7.x-1.x authored by JeffM2001
    Issue #2724331 by JeffM2001, dang42: "From Name" no longer works in v1.4
    
wundo’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

holtzman’s picture

I've had to reapply this patch in 1.6 and 1.7. Am I missing something?

jds1’s picture

@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.

anthonyroundtree’s picture

It 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?