summaryrefslogtreecommitdiffstats
path: root/system/libraries/Email.php
diff options
context:
space:
mode:
authorBruno Barão <brunobarao@gmail.com>2012-10-08 17:21:36 +0200
committerBruno Barão <brunobarao@gmail.com>2012-10-08 17:21:36 +0200
commit02561acf13f19881f4e3f95cf2fb423665d5ce8b (patch)
treefb88af9da77e37447d9e1513146aad870e65ea5d /system/libraries/Email.php
parentb453e16668c70b0eb02b5ae69cd3196d735421f8 (diff)
parent960e616d18c77f463e7c53f666d98b09f5ca9057 (diff)
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r--system/libraries/Email.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index b922cb1c0..507067f42 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -188,7 +188,7 @@ class CI_Email {
* @param string
* @return object
*/
- public function from($from, $name = '')
+ public function from($from, $name = '', $return_path = '')
{
if (preg_match('/\<(.*)\>/', $from, $match))
{
@@ -198,6 +198,10 @@ class CI_Email {
if ($this->validate)
{
$this->validate_email($this->_str_to_array($from));
+ if ($return_path)
+ {
+ $this->validate_email($this->_str_to_array($return_path));
+ }
}
// prepare the display name
@@ -216,7 +220,12 @@ class CI_Email {
}
$this->set_header('From', $name.' <'.$from.'>');
- $this->set_header('Return-Path', '<'.$from.'>');
+
+ if( ! $return_path)
+ {
+ $return_path = $from;
+ }
+ $this->set_header('Return-Path', '<'.$return_path.'>');
return $this;
}
@@ -1399,7 +1408,7 @@ class CI_Email {
{
// most documentation of sendmail using the "-f" flag lacks a space after it, however
// we've encountered servers that seem to require it to be in place.
- return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, '-f '.$this->clean_email($this->_headers['From']));
+ return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, '-f '.$this->clean_email($this->_headers['Return-Path']));
}
}
@@ -1412,7 +1421,7 @@ class CI_Email {
*/
protected function _send_with_sendmail()
{
- $fp = @popen($this->mailpath.' -oi -f '.$this->clean_email($this->_headers['From']).' -t', 'w');
+ $fp = @popen($this->mailpath.' -oi -f '.$this->clean_email($this->_headers['From']).' -t'.' -r '.$this->clean_email($this->_headers['Return-Path']), 'w');
if ($fp === FALSE OR $fp === NULL)
{