|
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: "ayne" <342741692@qq.com>
Return-Path: <342741692@qq.com>
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: "342741692@qq.com" <342741692@qq.com>
X-Sender: 342741692@qq.com
X-Mailer: CodeIgniter
X-Priority: 1 (Highest)
Message-ID: <523286cfe10a5@qq.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
这是一封测试邮件。
</pre>
邮箱的帐号密码smtp都没得问题
|
|