![](/img/trans.png)
[英]AWS SMTP mail error in CodeIgniter (Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.)
[英]Codeigniter: Your server might not be configured to send mail using this method. Unable to send email using PHP SMTP
这之前在我的实时服务器上工作,突然它不再发送电子邮件。 这是我得到的错误:
220 smtp30.relay.iad3a.emailsrvr.com ESMTP - VA 代码第 18.2-152.3:1 节禁止将此系统用于未经请求的批量电子邮件(垃圾邮件)您好:250-smtp30.relay.iad3a.emailsrvr.emailsrvr.com发送 AUTH LOGIN 命令。 错误:554 5.7.1 身份验证受限 (Z1E/233FC14) 来自:554 5.7.1 身份验证受限 (Z1E/233FC14) 遇到以下 SMTP 错误:554 5.7.1 身份验证受限 (Z1E/233FC14) 至:503 5.5.1错误的命令序列 遇到以下 SMTP 错误:503 5.5.1 错误的命令数据序列:503 5.5.1 错误的命令序列 遇到以下 SMTP 错误:503 5.5.1 错误的命令序列 221 2.7.0 错误:我也可以打破规则。 再见。 遇到以下 SMTP 错误:221 2.7.0 错误:我也可以破坏规则。 再见。 无法使用 PHP SMTP 发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件。
如果我在本地服务器上运行它,它会发送电子邮件。 我什至尝试将端口更改为 587,但仍然出现错误并且没有发送。 我的代码有什么问题。 谢谢!
这是我的代码:
$from = "no-reply@sample.com";
$from_name = "Daily logs";
$config['smtp_host'] = 'ssl://secure.sample.com';
$config['smtp_user'] = 'no-reply@sample.com';
$config['smtp_pass'] = ********;
$config['smtp_port'] = '465';
$config['protocol'] = 'smtp';
$config['mailtype'] = 'html';
$config['validate'] = 'FALSE';
$message = $email_message['html'];
$CI->email->initialize($config);
$CI->email->from($from, $from_name);
$CI->email->to($email_message['to']);
$CI->email->subject("Sample - ".$email_message['subject']);
$path=$_SERVER["DOCUMENT_ROOT"];
$file = $path.'/tmp/sample_data/sample_data_'.strtotime(date("y-m-d", strtotime('-1 day'))).'.csv';
$CI->email->attach($file);
$CI->email->message($message);
if(@$CI->email->send()){
$return = (object) array('http_response_code' => 200);
}
else{
echo $CI->email->print_debugger();
}
检查您的配置是否写入
$config['smtp_host'] = 'ssl://secure.sample.com';
$config['smtp_user'] = 'no-reply@sample.com';
$config['smtp_pass'] = ********;
我认为您可以通过 gmail 尝试这些要点,然后移动到您自己的配置只是为了测试您的代码是好的。 有时服务器可能不允许你,所以不要浪费时间。 gmail smtp 的链接从 PHP 页面使用 GMail SMTP 服务器发送电子邮件和使用带有 codeigniter 电子邮件库的 gmail smtp 发送电子邮件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.