From e4e5e5931bef673da6e3394e76f03b6a4d9b7036 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 29 May 2017 19:08:27 +0000 Subject: [PATCH] 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 --- smtp.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smtp.php b/smtp.php index 57b1901..aa5d7a9 100644 --- a/smtp.php +++ b/smtp.php @@ -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) {