SMTP Error(220-We do not authorize the use of this

2020-04-08 12:45发布

问题:


Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 3 years ago.

I am current using CodeIgniter 2.2.2 and I have the following code inside my controller:

        $config['protocol'] = "smtp";
        $config['smtp_host'] = "mail.domain.com";
        $config['smtp_port'] = "25";
        $config['smtp_user'] = "noreply@somedomain.com"; 
        $config['smtp_pass'] = "password";
        $config['charset'] = "utf-8";
        $config['mailtype'] = "html";
        $config['newline'] = "\r\n";
        $config['wordwrap'] = TRUE;
        $this->load->library('email');
        $this->email->initialize($config);

        $this->email->set_mailtype('html');
        $this->email->from('noreply@somedomain.com', 'www.somedomain.com');
        $this->email->to('someEmail');


        $this->email->subject('Email Authentication');
        $message = 'Hi';

        $this->email->message($message);

        $this->email->send();

I tried using port 465, and ssl://xxxxxxx.prod.iad2.secureserver.net. But i am getting no luck at all. I tried contacting the customer service, but nope. They really didn't help me much other than giving me links into things I already knew. Why am I getting the message? It is preventing me to send email to my other email addresses. Can anyone please help here?

回答1:

I'm having the same problem. After some research I found that the solution for me was:

 $config['protocol'] = "mail";
 $config['smtp_port'] = 587;