Trying to fix email sending
This commit is contained in:
parent
f873d51c86
commit
96bf160198
|
|
@ -1211,7 +1211,7 @@ EOT;
|
|||
if (!preg_match('/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/', $email)) {
|
||||
return '';
|
||||
}
|
||||
return "$email <$email>";
|
||||
return $email;
|
||||
}
|
||||
|
||||
function parse_email_to_array($input) {
|
||||
|
|
@ -1326,7 +1326,8 @@ function email_pdf_with_custom_recipients($id = null, $to = null, $cc = null, $b
|
|||
echo json_encode(array('success' => false, 'message' => $msg));
|
||||
return;
|
||||
} else {
|
||||
$this->Email->to = implode(', ', $toArray);
|
||||
// Pass as array - modified CakePHP EmailComponent now supports arrays for TO field
|
||||
$this->Email->to = $toArray;
|
||||
}
|
||||
$ccArray = $this->parse_email_to_array($cc);
|
||||
if (!empty($ccArray)) {
|
||||
|
|
|
|||
|
|
@ -712,9 +712,13 @@ class EmailComponent extends Object{
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!$this->__smtpSend('RCPT TO: ' . $this->__formatAddress($this->to, true))) {
|
||||
// Handle both single email (string) and multiple emails (array) for TO field
|
||||
$toRecipients = is_array($this->to) ? $this->to : array($this->to);
|
||||
foreach ($toRecipients as $to) {
|
||||
if (!$this->__smtpSend('RCPT TO: ' . $this->__formatAddress($to, true))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->cc as $cc) {
|
||||
if (!$this->__smtpSend('RCPT TO: ' . $this->__formatAddress($cc, true))) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue