Skip to content

Commit

Permalink
Update CMailFile.class.php
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Mar 12, 2018
1 parent f40e6e2 commit d6e98d3
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions htdocs/core/class/CMailFile.class.php
Expand Up @@ -349,6 +349,8 @@ function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_li

require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php';

require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php';
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php';
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailParser.php';
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailLexer.php';
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailValidator.php';
Expand Down Expand Up @@ -384,12 +386,30 @@ function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_li

// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (! empty($from)) $this->message->setFrom($this->getArrayAddress($from));
if (! empty($from)) {
try {
$this->message->setFrom($this->getArrayAddress($from));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}

// Set the To addresses with an associative array
if (! empty($to)) $this->message->setTo($this->getArrayAddress($to));
if (! empty($to)) {
try {
$this->message->setTo($this->getArrayAddress($to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}

if (! empty($replyto)) $this->message->SetReplyTo($this->getArrayAddress($replyto));
if (! empty($replyto)) {
try {
$this->message->SetReplyTo($this->getArrayAddress($replyto));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}

$this->message->setCharSet($conf->file->character_set_client);

Expand Down

0 comments on commit d6e98d3

Please sign in to comment.