dtj4307
2018-06-20 02:42
浏览 438
已采纳

CodeIgniter中的AWS SMTP邮件错误(无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。)

Am trying to send Email with AWS SMTP

auth access is passed, and configured everything but still got an error from CI

$this->load->library("email");
$config['mailtype'] = 'html';
$config['useragent']    = 'ses-smtp-user.20160628-105419'; //origon

$config['protocol']     = 'smtp';
$config['smtp_host']    = 'email-smtp.us-west-2.amazonaws.com'; //origon

$config['smtp_user']    = 'user key ';
$config['smtp_pass']    = 'password';
$config['smtp_port']    = '465';
$config['charset']  = 'utf-8';
$config['crlf'] = "
";      //should be "
"
$config['newline'] = "
";   //should be "
"
$config['wordwrap'] = TRUE;
$config['smtp_crypto'] = 'tls'; // TLS protocol
$config['email_newline'] = "
"; // SES hangs with just 


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

$this->email->from("email addr",'name');
$this->email->to("mail to");

$this->email->subject("test email");
$this->email->message("test!"); //메세지
$status = $this->email->send();
if($status) echo "IT WORKED!";
print_r($this->email->print_debugger());

am not sure to change 'useragent' value 'CodeIgniter' to 'ses-smtp-user.20160628-105419'

and got the following error using print_debugger() when im running this code

hello:
The following SMTP error was encountered:

starttls:
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.

Date: Wed, 20 Jun 2018 02:23:28 +0000
From: =?UTF-8?Q?=EB=B3=84=EB=AA=85?= <email>
Return-Path: <email>
To: mailto
Subject: =?UTF-8?Q?aws=20mail=20test=20mail=20f?==?UTF-8?Q?orm=20ori?= =?UTF-8?Q?gon!=20=20!?=
Reply-To: <email>
User-Agent: ses-smtp-user.20160628-105419
X-Sender: email
X-Mailer: ses-smtp-user.20160628-105419
X-Priority: 3 (Normal)
Message-ID: <email>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_5b29baa048f13"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_5b29baa048f13
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

test!


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

test=21

--B_ALT_5b29baa048f13--

图片转代码服务由CSDN问答提供 功能建议

尝试使用AWS SMTP发送电子邮件

传递auth访问权限, 并配置了所有内容,但仍然从CI

  $ this-&gt; load-&gt; library(“email”); 
 $ config ['mailtype'] =  'html'; 
 $ config ['useragent'] ='ses-smtp-user.20160628-105419';  // origon 
 
 $ config ['protocol'] ='smtp'; 
 $ config ['smtp_host'] ='email-smtp.us-west-2.amazonaws.com';  // origon 
 
 $ config ['smtp_user'] ='用户密钥'; 
 $ config ['smtp_pass'] ='密码'; 
 $ config ['smtp_port'] ='465'; 
  $ config ['charset'] ='utf-8'; 
 $ config ['crlf'] =“
 
”;  //应该是“
 
”
 $ config ['newline'] =“
 
”;  //应该是“
 
”
 $ config ['wordwrap'] = TRUE; 
 $ config ['smtp_crypto'] ='tls';  // TLS协议
 $ config ['email_newline'] =“
 
”;  // SES挂起只有
 
 
 $ this-&gt; email-&gt; initialize($ config); 
 
 $ this-&gt; email-&gt; from(“email addr”,'name'  ); 
 $ this-&gt; email-&gt; to(“mail to”); 
 
 $ this-&gt; email-&gt; subject(“test email”); 
 $ this-&gt; email  - &gt;消息( “测试!”);  //메세지
 $ status = $ this-&gt; email-&gt; send(); 
if($ status)echo“IT WORKED!”; 
print_r($ this-&gt; email-&gt; print_debugger())  ; 
   
 
 

我不确定将'useragent'值'CodeIgniter'更改为'ses-smtp-user.20160628-105419'

并在运行此代码时使用print_debugger()得到以下错误

  hello:
遇到以下SMTP错误:
 
starttls:
以下SMTP 遇到错误:
遇到以下SMTP错误:
 
无法使用PHP SMTP发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件。
 
日期:星期三,2018年6月20日02:23:28 +0000 
起始:=?UTF-8?Q?= EB = B3 = 84 = EB =  AA = 85?=&lt; email&gt; 
Return-Path:&lt; email&gt; 
To:mailto 
Subject:=?UTF-8?Q?aws = 20mail = 20test = 20mail = 20f?==?UTF-8?  Q?orm = 20ori?= =?UTF-8?Q?gon!= 20 = 20!?= 
Reply-To:&lt; email&gt; 
User-Agent:ses-smtp-user.20160628-105419 
X- 发件人:email 
X-Mailer:ses-smtp-user.20160628-105419 
X-Priority:3(正常)
消息ID:&lt; email&gt; 
Mime-版本:1.0 
 
 
内容类型: 多部分/替代;  boundary =“B_ALT_5b29baa048f13”
 
这是MIME格式的多部分消息。
您的电子邮件应用程序可能不支持此格式。
 
  -  B_ALT_5b29baa048f13 
Content-Type:text / plain;  charset = UTF-8 
Content-Transfer-Encoding:8bit 
 
test!
 
 
  -  B_ALT_5b29baa048f13 
Content-Type:text / html;  charset = UTF-8 
Content-Transfer-Encoding:quoted-printable 
 
test = 21 
 
  -  B_ALT_5b29baa048f13  -  
   
 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doufei3561 2018-06-20 04:44
    已采纳
    $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => 'xxx',
        'smtp_pass' => 'xxx',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    // set new line
    $this->email->set_newline("
    ");
    
    //set to, from, message body, etc.
    $result = $this->email->send();
    
    已采纳该答案
    打赏 评论

相关推荐 更多相似问题