doufei2662 2018-04-05 14:47
浏览 60
已采纳

电子邮件不发送代码点火器

I'm having a big problem with code igniter emails. When i'm working localhost the email is normaly send by smtp protocol, but when i up to the server the mail sending is not working.

My mail configurations :

$config['protocol'] = 'mail';
        $config['smtp_host'] = 'mail.duplov.com.br';
        $config['smtp_port'] = '587';
        $config['smtp_timeout'] = '30';
        $config['smtp_user']= '**********';
        $config['smtp_pass'] = '***********';
        $config['charset'] = 'utf-8';
        $config['newline'] = '
';
        $config['mailtype'] = 'html';

Detail tha stmp_pass and stmtp_user i just hide. My send email code :

public function validacao(){
        $this->load->library('form_validation');
        $this->form_validation->set_rules('nome','Nome','required|min_length[5]');
        $this->form_validation->set_rules('email','Email','required|valid_email');
        $this->form_validation->set_rules('telefone','Telefone','required|min_length[13]',array('min_length' => 'Você precisa colocar um telefone válido incluindo o DDD'));
        $this->form_validation->set_rules('mensagem','Mensagem','required|min_length[20]');

        if($this->form_validation->run() == FALSE){
            $erros = array('mensagens' => validation_errors());
            $jsonStr = json_encode($erros);
            echo $jsonStr;
        }
        else{
            if($mensagem = $this->enviar_mensagem($this->input->post('nome'),$this->input->post('email'),$this->input->post('telefone'),$this->input->post('mensagem'))){
                $sucesso['mensagens']   = 'sucesso';
                $jsonStr = json_encode($sucesso);
                echo $jsonStr;
            }else{
                $sucesso['mensagens']   = $this->email->print_debugger();
                $jsonStr = json_encode($sucesso);
                echo $jsonStr;
            }
        }
    }

    public function enviar_mensagem($nome,$email,$telefone,$mensagem){
        $this->load->model('funcoes');
        $this->funcoes ->contato($nome,$email,$telefone,$mensagem);
        $emails = $this->funcoes->get_infos();
        foreach ($emails as $em){
            $this->load->library('email');
            $dados['nome'] = $nome;
            $dados['email'] = $email;
            $dados['telefone'] = $telefone;
            $dados['mensagem'] = $mensagem;
            $mensagem = $this->load->view('email/template',$dados,true);
            $this->email->from("no-reply@duplov.com.br","Gerenciador do website");
            $this->email->to($em->email);
            $this->email->subject('Contato site');
            $this->email->message($mensagem);
            return $this->email->send();
        }

The error i'm getting :

220-a1-caju27.servidorwebfacil.com ESMTP Exim 4.89_1 #1 Thu, 05 Apr 2018 11:44:31 -0300 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. 
hello: 250-a1-caju27.servidorwebfacil.com Hello oestedeminas.cphost0027.servidorwebfacil.com [200.98.245.32]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-CHUNKING
250-STARTTLS
250 HELP
Failed to authenticate password. Error: 535 Incorrect authentication data
It is not possible to send e-mail using PHP SMTP. Your server may not be configured to send mail using this method.
  • 写回答

1条回答 默认 最新

  • doujiao9866 2018-04-06 07:35
    关注

    It looks like you are using $config['protocol'] = 'mail';

    Are you using the right protocol? Try changing to $config['protocol'] = 'smtp'; Make sure you enter the right smtp details and the outgoing port isn't blocked on your server too. Try another smtp server or test it again locally using MailSlurper, just to confirm.

    You can read more on email preferences here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵