Can you explain how I send email from a form by the locaweb servers, I have a site from a client hosted on locaweb, however the submission form does not work using their email, I wonder if someone already had a similar problem in locaweb using codeigniter and how you solved it.
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol']='smtp';
$config['smtp_host']='smtp.xxx.xxx';
$config['smtp_port']='587';
$config['smtp_timeout']='60';
$config['smtp_user']='xxxxx';
$config['smtp_pass']='xxxxx';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['mailtype']="html";
$config['smtp_crypto'] = 'tls';
$nome= $this->input->post('nome', TRUE);
$empresa = $this->input->post('nome-empresa', TRUE);
$telefone = $this->input->post('telefone', TRUE);
$celular = $this->input->post('celular', TRUE);
$email = $this->input->post('email', TRUE);
$cidade = $this->input->post('cidade', TRUE);
$bairro = $this->input->post('bairro', TRUE);
$endereco = $this->input->post('endereco', TRUE);
$data['email'] = [
'nome' =>$nome,
'empresa' =>$empresa,
'telefone' =>$telefone,
'celular' =>$celular,
'cidade' => $cidade,
'bairro' => $bairro,
'endereco' => $endereco,
'email' => $email
];
$mensagem = $this->load->view('template_email/index', $data, true);
$this->email->from($email);
$this->email->to('email');
$this->email->subject('Solicitação de Visita');
$this->email->message($mensagem);
$this->email->send();
echo $this->email->print_debugger();
In localhost send normal with other smtp servers, the settings are in config / email.php and they work, except in locaweb, how do anyone know?
The error returned is this:
The following SMTP error was encountered: 450 4.7.1: Recipient address rejected: Access Denied Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method