smtp: throw an exception if the TO is not defined
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3735 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
3
smtp.php
3
smtp.php
@@ -173,6 +173,9 @@ class smtp
|
|||||||
$from = $this->cleanMail ($from);
|
$from = $this->cleanMail ($from);
|
||||||
if (is_string ($to))
|
if (is_string ($to))
|
||||||
$to = array ($to);
|
$to = array ($to);
|
||||||
|
if (! is_array ($to) || count ($to) === 0)
|
||||||
|
throw new \Exception ("Can't send mail: no valid recipient provided",
|
||||||
|
500);
|
||||||
$this->putLine ("MAIL FROM: $from\r\n");
|
$this->putLine ("MAIL FROM: $from\r\n");
|
||||||
foreach ($to as $t)
|
foreach ($to as $t)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user