首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法发送AUTH登录命令。错误:无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件

无法发送AUTH登录命令。错误:无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件
EN

Stack Overflow用户
提问于 2017-12-26 19:38:53
回答 1查看 2.6K关注 0票数 0

我正在尝试使用PHP Code-Igniter从Office 365发送电子邮件。,但我得到了一个错误:

220 MAXPR0101CA0041.outlook.office 365.com Microsoft ESMTP MAIL Service ready at Tue,2017 12:17:56 +0000

您好:250-MAXPR0101CA0041.outlook.office 365.com您好115.96.169.89

250型- 157286400

250-流水线

250-DSN

250-增强统计代码

250-STARTTLS

250-8位

250-二进制最小值

250-分块

250 SMTPUTF8

无法发送AUTH登录命令。错误: 504 5.7.4无法识别的身份验证类型MAXPR0101CA0041.INDPRD01.PROD.OUTLOOK.COM

无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。

日期: 2017 -12- 26 12:17:56 +0100

发自:

返回路径:

收件人: myemail@mydomain.com

主题:=?UTF-8?q?Test=20电子邮件?=

回复:

用户代理: CodeIgniter

X-发件人: myemail@mydomain.com

X邮件: CodeIgniter

X优先级:3(正常)

消息ID:5a422fe430795@mydomain.com

Mime-版本: 1.0

内容类型: multipart/alternative;boundary="B_ALT_5a422fe4307e9“

这是MIME格式的多部分邮件。您的电子邮件应用程序可能不支持此格式。

--B_ALT_5a422fe4307e9内容类型:文本/纯文本;字符集=UTF-8内容传输编码: 8bit

SMTP正在发送测试电子邮件,完成...

--B_ALT_5a422fe4307e9 Content-Type: text/html;charset=UTF-8 Content-Transfer-Encoding: quoted-printable

SMTP正在发送测试电子邮件,完成...

--B_ALT_5a422fe4307e9--

这里是我的控制器代码:

代码语言:javascript
复制
public function emailSend()
    {
        # code...
        /*
        Minimun test code for successful email sending over SMTP with Office 365
        Things to double-check: 
        - openssl php extension must be enabled in the server
        - host set to smtp.office365.com, not the old aliases
        - Port 587
        - newline configuration: explicit to "\r\n"
        */

        //In your Controller code:

        $this->load->library('email');        

        //$config = [
            $config['protocol']= 'smtp';
            $config['mailpath']= "/usr/lib/sendmail";
            $config['smtp_port']= 587;
            $config['smtp_timeout'] = '7';
            $config['smtp_host']= 'smtp-mail.outlook.com';
            $config['smtp_user']= 'myemail@mydomain.com';
            $config['smtp_pass']= '*********';
            $config['smtp_crypto']= 'STARTTLS';   
            $config['newline']= "\r\n"; //REQUIRED! Notice the double quotes!
            $config['crlf']= "\r\n";
            $config['mailtype'] = 'html';
        //];

        $this->email->initialize($config);

        $this->email->from('myemail@mydomain.com');        
        $this->email->to('myemail@mydomain.com');
        $this->email->subject('Test Email');
        $this->email->message('SMTP sending test email, Done...');

        $sent = $this->email->send();


        if ($sent) 
        {
            echo 'OK';

        } else {
            echo $this->email->print_debugger();
        }

    }

我检查了很多链接和问题,但没有成功。我不明白代码中的确切错误是什么。

注:我已经尝试过了

代码语言:javascript
复制
$config['smtp_port']= 465; 
$config['smtp_crypto']= 'TLS';
$config['smtp_crypto']= 'SSL';

任何形式的帮助都是受欢迎的,提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2018-05-28 08:36:04

有类似的问题,我的解决方案正在改变,

代码语言:javascript
复制
$config['protocol'] = "smtp";

至:

代码语言:javascript
复制
$config['protocol'] = "sendmail";
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47978089

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档