W.I.P. smime support:

- Make sure recipients addresses are not in RFC822 format
This commit is contained in:
Hadi Nategh 2017-04-11 17:29:44 +02:00
parent 1a63b5681d
commit df998bab26
2 changed files with 19 additions and 2 deletions

View File

@ -7171,4 +7171,21 @@ class Mail
error_log(__METHOD__.' ('.__LINE__.') '.' NOT DONE YET!' . ' hookValue = '. $_hookValues); error_log(__METHOD__.' ('.__LINE__.') '.' NOT DONE YET!' . ' hookValue = '. $_hookValues);
} }
/**
* This function gets array of email addresses in RFC822 format
* and tries to normalize the addresses into only email addresses.
*
* @param array $_addresses Addresses
*/
static function stripRFC822Addresses ($_addresses)
{
$matches = array();
foreach ($_addresses as &$address)
{
preg_match("/<([^\'\" <>]+)>$/", $address, $matches);
if ($matches[1]) $address = $matches[1];
}
return $_addresses;
}
} }

View File

@ -2964,7 +2964,7 @@ class mail_compose
$smime_success = $this->_encrypt( $smime_success = $this->_encrypt(
$mail, $mail,
$_formData['smime_encrypt'] == 'on'? Mail\Smime::TYPE_SIGN_ENCRYPT: Mail\Smime::TYPE_SIGN, $_formData['smime_encrypt'] == 'on'? Mail\Smime::TYPE_SIGN_ENCRYPT: Mail\Smime::TYPE_SIGN,
$_formData['to'], Mail::stripRFC822Addresses($_formData['to']),
$identity['ident_email'], $identity['ident_email'],
$_formData['smime_passphrase'] $_formData['smime_passphrase']
); );
@ -2980,7 +2980,7 @@ class mail_compose
$smime_success = $this->_encrypt( $smime_success = $this->_encrypt(
$mail, $mail,
Mail\Smime::TYPE_ENCRYPT, Mail\Smime::TYPE_ENCRYPT,
$_formData['to'], Mail::stripRFC822Addresses($_formData['to']),
$identity['ident_email'] $identity['ident_email']
); );
} }