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) {