diff options
author | Michael Granados <michaelgranados@gmail.com> | 2014-11-09 05:43:48 +0100 |
---|---|---|
committer | Michael Granados <michaelgranados@gmail.com> | 2014-11-09 05:43:48 +0100 |
commit | 0b85d6b3bb0236a6567ebc8f42b643d5486070ef (patch) | |
tree | 13103a01da0b0628b5ffc9ca6e7bf490953a678b | |
parent | 32a077a73e33bc3367db6353d21300259e2cc4d2 (diff) |
Verifying From header before send mail
Signed-off-by: Michael Granados <michaelgranados@gmail.com>
-rw-r--r-- | system/language/english/email_lang.php | 1 | ||||
-rw-r--r-- | system/libraries/Email.php | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php index fdd823bc8..d63e700fe 100644 --- a/system/language/english/email_lang.php +++ b/system/language/english/email_lang.php @@ -41,6 +41,7 @@ $lang['email_must_be_array'] = 'The email validation method must be passed an ar $lang['email_invalid_address'] = 'Invalid email address: %s'; $lang['email_attachment_missing'] = 'Unable to locate the following email attachment: %s'; $lang['email_attachment_unreadable'] = 'Unable to open this attachment: %s'; +$lang['email_no_sender'] = 'You must include sender (From)'; $lang['email_no_recipients'] = 'You must include recipients: To, Cc, or Bcc'; $lang['email_send_failure_phpmail'] = 'Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.'; $lang['email_send_failure_sendmail'] = 'Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.'; diff --git a/system/libraries/Email.php b/system/libraries/Email.php index a55d2ffea..34ce5b156 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1630,6 +1630,12 @@ class CI_Email { */ public function send($auto_clear = TRUE) { + if ( ! isset($this->_headers['From']) ) + { + $this->_set_error_message('lang:email_no_sender'); + return FALSE; + } + if ($this->_replyto_flag === FALSE) { $this->reply_to($this->_headers['From']); |