From 7aa0ed45932eec49be00fee0f6de744094fc954b Mon Sep 17 00:00:00 2001 From: Francois Gaillard Date: Thu, 10 May 2012 15:02:19 +0000 Subject: [PATCH] [-] Classes : #PSCFI-4973 : Bug fix mail receiver was null --- classes/Mail.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/Mail.php b/classes/Mail.php index b54f4d255..ca1e98862 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -133,6 +133,8 @@ class MailCore if ($toName && is_array($toName) && Validate::isGenericName($toName[$key])) $to_name = $toName[$key]; } + if ($to_name == null) + $to_name = $addr; /* Encode accentuated chars */ $to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?='); } @@ -141,6 +143,8 @@ class MailCore } else { /* Simple recipient, one address */ $to_plugin = $to; + if ($toName == null) + $toName = $to; $to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($toName).'?='); } try { @@ -230,7 +234,6 @@ class MailCore if (isset($attachment['content']) && isset($attachment['name']) && isset($attachment['mime'])) $message->attach(new Swift_Message_Attachment($attachment['content'], $attachment['name'], $attachment['mime'])); } - /* Send mail */ $send = $swift->send($message, $to, new Swift_Address($from, $fromName)); $swift->disconnect();