这是在我的实时服务器上工作的,然后突然不再发送电子邮件了。这是我得到的错误:
220 smtp30.relay.iad3a.emailsrvr.com ESMTP-VA代码第18.2-152.3:1节禁止将此系统用于未经请求的批量电子邮件(垃圾邮件) 您好:250-smtp30.relay.iad3a.emailsrvr.com 250个增强的状态码 无法发送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();
}
答案 0 :(得分:0)
检查您的配置是否为写
$config['smtp_host'] = 'ssl://secure.sample.com';
$config['smtp_user'] = 'no-reply@sample.com';
$config['smtp_pass'] = ********;
我认为您可以通过gmail尝试这些要点,然后仅出于测试您的代码就可以使用自己的配置。有时服务器可能不允许您这样做,所以不要浪费时间。 gmail smtp Send email using the GMail SMTP server from a PHP page和Sending email with gmail smtp with codeigniter email library
的链接