mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 11:23:54 +01:00
* eMail: remove invalid -at- when occurring in full name, when adding address to email; skip addresses that produce a parse error while parsed with imap_rfc822_parse_adrlist
This commit is contained in:
parent
cf2943435d
commit
3b8fa83acc
@ -729,7 +729,7 @@ class addressbook_ui extends addressbook_bo
|
||||
}
|
||||
if($email)
|
||||
{
|
||||
$contact['n_fn'] = str_replace(',',' ',$contact['n_fn']);
|
||||
$contact['n_fn'] = str_replace(array(',','@'),' ',$contact['n_fn']);
|
||||
egw_framework::set_onload("addEmail('".addslashes(
|
||||
$contact['n_fn'] ? $contact['n_fn'].' <'.trim($email).'>' : trim($email))."');");
|
||||
//error_log(__METHOD__.__LINE__."addEmail('".addslashes(
|
||||
|
@ -71,7 +71,7 @@
|
||||
foreach(array($contact['email'],$contact['email_home']) as $email) {
|
||||
// avoid wrong addresses, if an rfc822 encoded address is in addressbook
|
||||
$email = preg_replace("/(^.*<)([a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-\.]+)(.*)/",'$2',$email);
|
||||
$contact['n_fn'] = str_replace(',',' ',$contact['n_fn']);
|
||||
$contact['n_fn'] = str_replace(array(',','@'),' ',$contact['n_fn']);
|
||||
$completeMailString = addslashes(trim($contact['n_fn'] ? $contact['n_fn'] : $contact['fn']) .' <'. trim($email) .'>');
|
||||
if(!empty($email) && in_array($completeMailString ,$jsArray) === false) {
|
||||
$i++;
|
||||
|
@ -712,40 +712,44 @@
|
||||
foreach((array)$_formData['to'] as $address) {
|
||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address), '');
|
||||
foreach((array)$address_array as $addressObject) {
|
||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||
#$emailName = $bofelamimail->encodeHeader($addressObject->personal, 'q');
|
||||
#$_mailObject->AddAddress($emailAddress, $emailName);
|
||||
$_mailObject->AddAddress($emailAddress, $addressObject->personal);
|
||||
$_mailObject->AddAddress($emailAddress, str_replace(array('@'),' ',$addressObject->personal));
|
||||
}
|
||||
}
|
||||
|
||||
foreach((array)$_formData['cc'] as $address) {
|
||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
||||
foreach((array)$address_array as $addressObject) {
|
||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||
#$emailName = $bofelamimail->encodeHeader($addressObject->personal, 'q');
|
||||
#$_mailObject->AddCC($emailAddress, $emailName);
|
||||
$_mailObject->AddCC($emailAddress, $addressObject->personal);
|
||||
$_mailObject->AddCC($emailAddress, str_replace(array('@'),' ',$addressObject->personal));
|
||||
}
|
||||
}
|
||||
|
||||
foreach((array)$_formData['bcc'] as $address) {
|
||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
||||
foreach((array)$address_array as $addressObject) {
|
||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||
#$emailName = $bofelamimail->encodeHeader($addressObject->personal, 'q');
|
||||
#$_mailObject->AddBCC($emailAddress, $emailName);
|
||||
$_mailObject->AddBCC($emailAddress, $addressObject->personal);
|
||||
$_mailObject->AddBCC($emailAddress, str_replace(array('@'),' ',$addressObject->personal));
|
||||
}
|
||||
}
|
||||
|
||||
foreach((array)$_formData['replyto'] as $address) {
|
||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
||||
foreach((array)$address_array as $addressObject) {
|
||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||
#$emailName = $bofelamimail->encodeHeader($addressObject->personal, 'q');
|
||||
#$_mailObject->AddBCC($emailAddress, $emailName);
|
||||
$_mailObject->AddReplyto($emailAddress, $addressObject->personal);
|
||||
$_mailObject->AddReplyto($emailAddress, str_replace(array('@'),' ',$addressObject->personal));
|
||||
}
|
||||
}
|
||||
|
||||
@ -980,6 +984,7 @@
|
||||
//$mail->SMTPDebug = 10;
|
||||
//error_log("Folder:".count(array($this->sessionData['folder']))."To:".count((array)$this->sessionData['to'])."CC:". count((array)$this->sessionData['cc']) ."bcc:".count((array)$this->sessionData['bcc']));
|
||||
if(count((array)$this->sessionData['to']) > 0 || count((array)$this->sessionData['cc']) > 0 || count((array)$this->sessionData['bcc']) > 0) {
|
||||
error_log(__METHOD__.__LINE__.array2string($mail));
|
||||
try {
|
||||
$mail->Send();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user