From 0b85d6b3bb0236a6567ebc8f42b643d5486070ef Mon Sep 17 00:00:00 2001 From: Michael Granados Date: Sun, 9 Nov 2014 02:43:48 -0200 Subject: Verifying From header before send mail Signed-off-by: Michael Granados --- system/language/english/email_lang.php | 1 + system/libraries/Email.php | 6 ++++++ 2 files changed, 7 insertions(+) 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']); -- cgit v1.2.3-24-g4f1b From 92e2fd2320a27519922e2927cf810d8c846e7b4e Mon Sep 17 00:00:00 2001 From: Michael Granados Date: Tue, 11 Nov 2014 21:49:26 -0200 Subject: Making required changes Signed-off-by: Michael Granados --- system/language/english/email_lang.php | 4 ++-- system/libraries/Email.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php index d63e700fe..b7b09f2c2 100644 --- a/system/language/english/email_lang.php +++ b/system/language/english/email_lang.php @@ -41,7 +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_from'] = 'Cannot send mail with no "From" header.'; $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.'; @@ -58,4 +58,4 @@ $lang['email_smtp_data_failure'] = 'Unable to send data: %s'; $lang['email_exit_status'] = 'Exit status code: %s'; /* End of file email_lang.php */ -/* Location: ./system/language/english/email_lang.php */ \ No newline at end of file +/* Location: ./system/language/english/email_lang.php */ diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 34ce5b156..454482ef4 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1630,9 +1630,9 @@ class CI_Email { */ public function send($auto_clear = TRUE) { - if ( ! isset($this->_headers['From']) ) + if ( ! isset($this->_headers['From'])) { - $this->_set_error_message('lang:email_no_sender'); + $this->_set_error_message('lang:email_no_from'); return FALSE; } @@ -2273,4 +2273,4 @@ class CI_Email { } /* End of file Email.php */ -/* Location: ./system/libraries/Email.php */ \ No newline at end of file +/* Location: ./system/libraries/Email.php */ -- cgit v1.2.3-24-g4f1b From dfa1e4034ee944ee250aea46322565188dab2ab3 Mon Sep 17 00:00:00 2001 From: Michael Granados Date: Wed, 12 Nov 2014 23:19:07 -0200 Subject: Removing empty lines Signed-off-by: Michael Granados --- system/language/english/email_lang.php | 2 +- system/libraries/Email.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php index b7b09f2c2..b6f03c71c 100644 --- a/system/language/english/email_lang.php +++ b/system/language/english/email_lang.php @@ -58,4 +58,4 @@ $lang['email_smtp_data_failure'] = 'Unable to send data: %s'; $lang['email_exit_status'] = 'Exit status code: %s'; /* End of file email_lang.php */ -/* Location: ./system/language/english/email_lang.php */ +/* Location: ./system/language/english/email_lang.php */ \ No newline at end of file diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 454482ef4..5cb16896f 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -2273,4 +2273,4 @@ class CI_Email { } /* End of file Email.php */ -/* Location: ./system/libraries/Email.php */ +/* Location: ./system/libraries/Email.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b