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.

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

报告相同问题?

悬赏问题

  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?