summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Email.php33
1 files changed, 23 insertions, 10 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index f8772c656..be89d6569 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1919,6 +1919,7 @@ class CI_Email {
if ( ! $this->_send_command('from', $this->clean_email($this->_headers['From'])))
{
+ $this->_smtp_end();
return FALSE;
}
@@ -1926,6 +1927,7 @@ class CI_Email {
{
if ( ! $this->_send_command('to', $val))
{
+ $this->_smtp_end();
return FALSE;
}
}
@@ -1936,6 +1938,7 @@ class CI_Email {
{
if ($val !== '' && ! $this->_send_command('to', $val))
{
+ $this->_smtp_end();
return FALSE;
}
}
@@ -1947,6 +1950,7 @@ class CI_Email {
{
if ($val !== '' && ! $this->_send_command('to', $val))
{
+ $this->_smtp_end();
return FALSE;
}
}
@@ -1954,6 +1958,7 @@ class CI_Email {
if ( ! $this->_send_command('data'))
{
+ $this->_smtp_end();
return FALSE;
}
@@ -1963,30 +1968,38 @@ class CI_Email {
$this->_send_data('.');
$reply = $this->_get_smtp_data();
-
$this->_set_error_message($reply);
+ $this->_smtp_end();
+
if (strpos($reply, '250') !== 0)
{
$this->_set_error_message('lang:email_smtp_error', $reply);
return FALSE;
}
- if ($this->smtp_keepalive)
- {
- $this->_send_command('reset');
- }
- else
- {
- $this->_send_command('quit');
- }
-
return TRUE;
}
// --------------------------------------------------------------------
/**
+ * SMTP End
+ *
+ * Shortcut to send RSET or QUIT depending on keep-alive
+ *
+ * @return void
+ */
+ protected function _smtp_end()
+ {
+ ($this->smtp_keepalive)
+ ? $this->_send_command('reset')
+ : $this->_send_command('quit');
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* SMTP Connect
*
* @return string