use smpt-username as sender, if available, but only if it is a full email address

This commit is contained in:
Ralf Becker 2014-08-22 13:26:18 +00:00
parent 874be20a6c
commit bf990975a7

View File

@ -60,7 +60,9 @@ class send extends egw_mailer
$this->Username = $account->acc_smtp_username;
$this->Password = $account->acc_smtp_password;
$this->defaultDomain = $account->acc_domain;
$this->Sender = $account->acc_smtp_username?$account->acc_smtp_username:emailadmin_account::rfc822($account);
// use smpt-username as sender, if available, but only if it is a full email address
$this->Sender = $account->acc_smtp_username && strpos($account->acc_smtp_username, '@') !== false ?
$account->acc_smtp_username : $account->acc_ident_email;
$this->Hostname = $GLOBALS['egw_info']['server']['hostname'];
@ -82,7 +84,6 @@ class send extends egw_mailer
$this->FromName = $GLOBALS['egw_info']['user']['account_fullname'];
$this->From = $GLOBALS['egw_info']['user']['account_email'];
$this->Sender = '';
$this->AddCustomHeader('X-Mailer:eGroupWare (http://www.eGroupWare.org)');
}