I've been searching information on this but can't find any. Here is my code (from controller):
public function send_mail(){
$config = Array(
'protocol' => 'smtp',
'smt_host' => 'ssl://smtp.gmail.com',
'smtp_port' => '465',
'smtp_user' => '[email protected]',
'smtp_pass' => 'password',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email');
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'MyName');
$this->email->to('[email protected]');
$this->email->subject('Message');
$this->email->message('Some text.');
if ($this->email->send())
echo "twas sent";
else show_error ($this->email->print_debugger());
}
Now the error I get from debugger is:
You did not specify a SMTP hostname.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Date: Tue, 9 May 2017 22:16:37 +0200
From: "MyName" <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?ISO-8859-1?Q?=47=65=74=47=61=69=6E=73=20=4D=65=73=73=61=67=65?=
Reply-To: <[email protected]>
User-Agent: CodeIgniter
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Some text.
The thing is I cannot understand how did I not specify SMTP hostname? I've tried ports like 465 and 587, tried hosts like 'ssl://smtp.gmail.com', 'ssl://smtp.googlemail.com', 'smtp.gmail.com', etc.
P.S. Instead of [email protected] and password stands my real gmail with password.
smt_hostwrong? - Alex Howanskyssl://smtp.googlemail.com- Kelvin