3
I cannot send email, from the error message below. I am 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());
}
}
Welcome to Stackoverflow in English. Make a tour to learn how the site works.
– gato
Friend, use the Mandrill api. With it you can send emails via post request, so you don’t even need to set up the smtp on your server.
– LF Ziron
Follow this video. It shows step by step, is very explanatory. I did the same project a while ago using Apache and xammp.
– zwitterion