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:
2017-05-29 19:08:27 +00:00
parent 527304aee7
commit e4e5e5931b

View File

@@ -173,6 +173,9 @@ class smtp
$from = $this->cleanMail ($from);
if (is_string ($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");
foreach ($to as $t)
{