I found even I set the E-mail from ("smtp_from" in variable table), the send address is still the site address ("site_mail" in variable table).

I checked the code and I guess the reason is here. I found the $from is not empty and is not the same as 'smtp_from', but I cannot find which program assign the $from value.

  //If from email address is blank use smtp_from config option
  if ($from == '' && variable_get('smtp_from', '') != ''){
    $from = variable_get('smtp_from', '');
  }

And when I marked the if condition, the smtp module get the smtp_from now.

  //If from email address is blank use smtp_from config option
//  if ($from == '' && variable_get('smtp_from', '') != ''){
    $from = variable_get('smtp_from', '');
//  }

Comments

dennys’s picture

I found the mail from drupal is noreply@drupal.org, I think it's correct. Especially when I use Forward module. If smtp always uses the site address, then an spamer just need to forward a mail to himself and he can get the email address of the site administrator.

oadaeh’s picture

I could not reproduce this behavior. See my comment here: http://drupal.org/node/207925#comment-692784

oadaeh’s picture

Assigned: Unassigned » oadaeh
Priority: Critical » Normal

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.

yudi_set’s picture

Hi,
I'm a newbie.

Just wondering any updates yet on resolving this issue?

Thank you.

rfay’s picture

An odd piece of information:

On cpanel, Centos 5, I suddenly got correct "From" addresses when I changed to use authentication and use a regular user account. Previously I had been using the email account of the account master (an account like 'roger') but when I switched to use an ordinary user account like 'roger@example.com', I got correct from addresses (the from specified by smtp module).

craig_’s picture

i don't know how to link duplicate issues, but there's a patch for this now over at

#295655: Email from address won't change
http://drupal.org/node/295655#comment-3809694

akalata’s picture

Status: Needs work » Closed (duplicate)

Per craig_, marking as duplicate of #295655: Email from address won't change.