Skip to content
Snippets Groups Projects
Commit f32b35db authored by Peter Rotich's avatar Peter Rotich
Browse files

Use email address when FROM field doesn't have a name.

parent 71246350
Branches
Tags
No related merge requests found
......@@ -372,16 +372,20 @@ class MailFetcher {
$emailId = $this->getEmailId();
$vars = array();
$vars['name']=$this->mime_decode($mailinfo['name']);
$vars['email']=$mailinfo['email'];
$vars['name']=$this->mime_decode($mailinfo['name']);
$vars['subject']=$mailinfo['subject']?$this->mime_decode($mailinfo['subject']):'[No Subject]';
$vars['message']=Format::stripEmptyLines($this->getBody($mid));
$vars['header']=$this->getHeader($mid);
$vars['emailId']=$emailId?$emailId:$ost->getConfig()->getDefaultEmailId(); //ok to default?
$vars['name']=$vars['name']?$vars['name']:$vars['email']; //No name? use email
$vars['mid']=$mailinfo['mid'];
if(!$vars['message']) //An email with just attachments can have empty body.
//Missing FROM name - use email address.
if(!$vars['name'])
$vars['name'] = $vars['email'];
//An email with just attachments can have empty body.
if(!$vars['message'])
$vars['message'] = '(EMPTY)';
if($ost->getConfig()->useEmailPriority())
......
......@@ -289,11 +289,15 @@ class EmailDataParser {
break;
}
$data['email'] = $from->mailbox.'@'.$from->host;
$data['name'] = trim($from->personal,'"');
if($from->comment && $from->comment[0])
$data['name'].= ' ('.$from->comment[0].')';
$data['email'] = $from->mailbox.'@'.$from->host;
//Use email address as name when FROM address doesn't have a name.
if(!$data['name'] && $data['email'])
$data['name'] = $data['email'];
}
//TO Address:Try to figure out the email address... associated with the incoming email.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment