Send using SMTP
bool Core_Email::_send_with_smtp( )
bool
protected function _send_with_smtp()
{
if ($this->smtp_host === '')
{
$this->_set_error_message('lang:email_no_hostname');
return false;
}
if ( ! $this->_smtp_connect() || ! $this->_smtp_authenticate())
{
return false;
}
$this->_send_command('from', $this->clean_email($this->_headers['From']));
foreach ($this->_recipients as $val)
{
$this->_send_command('to', $val);
}
if (count($this->_cc_array) > 0)
{
foreach ($this->_cc_array as $val)
{
if ($val !== '')
{
$this->_send_command('to', $val);
}
}
}
if (count($this->_bcc_array) > 0)
{
foreach ($this->_bcc_array as $val)
{
if ($val !== '')
{
$this->_send_command('to', $val);
}
}
}
$this->_send_command('data');
// perform dot transformation on any lines that begin with a dot
$this->_send_data($this->_header_str.preg_replace('/^\./m', '..$1', $this->_finalbody));
$this->_send_data('.');
$reply = $this->_get_smtp_data();
$this->_set_error_message($reply);
if (strpos($reply, '250') !== 0)
{
$this->_set_error_message('lang:email_smtp_error', $reply);
return false;
}
$this->_send_command('quit');
return true;
}