用户
 找回密码
 入住 CI 中国社区
搜索
查看: 6404|回复: 7
收起左侧

email的smtp老是发不出去???

[复制链接]
发表于 2013-9-13 11:37:30 | 显示全部楼层 |阅读模式
PHP复制代码
 
        $this->load->library('email');
 
        $mail_to = trim($this->input->post('mail_to'));
        $config['protocol'] = 'smtp';//trim($this->input->post('protocol'));
        $config['smtp_host'] = trim($this->input->post('smtp_host'));
        $config['smtp_user'] = trim($this->input->post('smtp_user'));
        $config['smtp_pass'] = trim($this->input->post('smtp_pass'));
        $config['smtp_port'] = trim($this->input->post('smtp_port'));
        $config['charset'] = 'utf-8';//'iso-8859-1';
        $config["validate"] = true;
        $config["priority"] = 1;
        $config['crlf'] = "\r\n";
        $config['newline'] = "\r\n";
        $this->email->initialize($config);
 
        $this->email->from($config['smtp_user'], 'Payne');
        $this->email->to($mail_to);
        $this->email->subject('测试邮件。');
        $this->email->message('这是一封测试邮件。');
        $this->email->send();
        echo $this->email->print_debugger();exit;
 
复制代码


Invalid email address: <br />220 smtp.qq.com Esmtp QQ Mail Server

<br /><pre>hello: 250-smtp.qq.com

250-PIPELINING

250-SIZE 52428800

250-AUTH LOGIN PLAIN

250-AUTH=LOGIN

250-MAILCOMPRESS

250 8BITMIME

</pre><pre>from: 250 Ok

</pre><pre>to: 501 Bad address syntax

</pre>The following SMTP error was encountered: 501 Bad address syntax

<br /><pre>data: 503 Error: need RCPT command

</pre>The following SMTP error was encountered: 503 Error: need RCPT command

<br />501 Error: malformed authentication response

<br />The following SMTP error was encountered: 501 Error: malformed authentication response

<br />Unable to send email using PHP SMTP.  Your server might not be configured to send mail using this method.<br /><pre>User-Agent: CodeIgniter

Date: Fri, 13 Sep 2013 11:30:23 +0800

From: &quotayne&quot; &lt;342741692@qq.com&gt;

Return-Path: &lt;342741692@qq.com&gt;

Subject: =?utf-8?Q?=e4=bc=98=e7=9b=9f=e6=95=99=e8=82=b2=e6=b5=8b=e8=af=95=e9=82
?=
=?utf-8?Q?=ae=e4=bb=b6=e3=80=82?=

Reply-To: &quot;342741692@qq.com&quot; &lt;342741692@qq.com&gt;

X-Sender: 342741692@qq.com

X-Mailer: CodeIgniter

X-Priority: 1 (Highest)

Message-ID: &lt;523286cfe10a5@qq.com&gt;

Mime-Version: 1.0



Content-Type: text/plain; charset=utf-8

Content-Transfer-Encoding: 8bit



这是一封测试邮件。

</pre>



QQ截图20130913113619.png



邮箱的帐号密码smtp都没得问题

发表于 2013-9-13 12:36:30 | 显示全部楼层
urlencode 和 urldecode 大概这样 你可以试试
 楼主| 发表于 2013-9-13 13:46:44 | 显示全部楼层
IvanCI 发表于 2013-9-13 12:36
urlencode 和 urldecode 大概这样 你可以试试

你指是 邮箱地址吗 ?
我urldecode试过了 ,直接填写邮箱地址不用post也试过了 一样的错误

 楼主| 发表于 2013-9-13 13:52:09 | 显示全部楼层
IvanCI 发表于 2013-9-13 12:36
urlencode 和 urldecode 大概这样 你可以试试

Failed to authenticate username. Error:
from: The following SMTP error was encountered:
to: The following SMTP error was encountered:
data: The following SMTP error was encountered:

The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
 楼主| 发表于 2013-9-13 13:59:32 | 显示全部楼层
pxc2471418 发表于 2013-9-13 13:46
你指是 邮箱地址吗 ?
我urldecode试过了 ,直接填写邮箱地址不用post也试过了 一样的错误

Failed to authenticate username. Error:
from: The following SMTP error was encountered:
to: The following SMTP error was encountered:
data: The following SMTP error was encountered:

The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter

但是帐号密码都是对的

 楼主| 发表于 2013-9-13 14:22:13 | 显示全部楼层
已经解决 谢谢了
发表于 2013-12-5 15:51:23 | 显示全部楼层
pxc2471418 发表于 2013-9-13 14:22
已经解决 谢谢了

怎么解决的,我也遇到这个问题了
发表于 2014-10-13 15:04:32 | 显示全部楼层
怎么找到的,我的还是不行。

本版积分规则