I can not send email, giving the error message below. I'm using xampp, via localhost.
ello:
The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Sun, 24 Apr 2016 10:01:58 -0300
From: "Meu" <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: assunto de e-mail
Reply-To: "[email protected]" <[email protected]>
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
function enviar_mensagem(){
$mensagem = "Nome:".$this->input->post('txt_nome').br();
$mensagem .= "E-mail:".$this->input->post('txt_email').br();
$mensagem .= "Menagem:".$this->input->post('txt_mensagem').br();
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'XXXXXXX';
$config['protocol'] = 'smtp';
$config['validate'] = TRUE;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$this->load->library('email', $config);
$this->email->from('[email protected]', 'Meu');
$this->email->to('[email protected]');
$this->email->subject('assunto de e-mail');
$this->email->message($mensagem);
if ($this->email->send()) {
$this->load->view('sucesso_envia_contato');
}
else {
print_r($this->email->print_debugger());
}
}