简体   繁体   English

Codeigniter:您的服务器可能未配置为使用此方法发送邮件。 无法使用 PHP SMTP 发送电子邮件

[英]Codeigniter: Your server might not be configured to send mail using this method. Unable to send email using PHP SMTP

This was working on my live server before then suddenly it's no longer sending emails.这之前在我的实时服务器上工作,突然它不再发送电子邮件。 Here's the error I got:这是我得到的错误:

220 smtp30.relay.iad3a.emailsrvr.com ESMTP - VA Code Section 18.2-152.3:1 forbids use of this system for unsolicited bulk electronic mail (Spam) hello: 250-smtp30.relay.iad3a.emailsrvr.com 250 ENHANCEDSTATUSCODES Failed to send AUTH LOGIN command. 220 smtp30.relay.iad3a.emailsrvr.com ESMTP - VA 代码第 18.2-152.3:1 节禁止将此系统用于未经请求的批量电子邮件(垃圾邮件)您好:250-smtp30.relay.iad3a.emailsrvr.emailsrvr.com发送 AUTH LOGIN 命令。 Error: 554 5.7.1 authentication restricted (Z1E/233FC14) from: 554 5.7.1 authentication restricted (Z1E/233FC14) The following SMTP error was encountered: 554 5.7.1 authentication restricted (Z1E/233FC14) to: 503 5.5.1 Bad sequence of commands The following SMTP error was encountered: 503 5.5.1 Bad sequence of commands data: 503 5.5.1 Bad sequence of commands The following SMTP error was encountered: 503 5.5.1 Bad sequence of commands 221 2.7.0 Error: I can break rules, too.错误: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 错误:我也可以打破规则。 Goodbye.再见。 The following SMTP error was encountered: 221 2.7.0 Error: I can break rules, too.遇到以下 SMTP 错误:221 2.7.0 错误:我也可以破坏规则。 Goodbye.再见。 Unable to send email using PHP SMTP.无法使用 PHP SMTP 发送电子邮件。 Your server might not be configured to send mail using this method.您的服务器可能未配置为使用此方法发送邮件。

If I run it on my local server it's sending emails.如果我在本地服务器上运行它,它会发送电子邮件。 I even tried changing the ports to 587 and I still got error and it's not sending.我什至尝试将端口更改为 587,但仍然出现错误并且没有发送。 What would be the issue in my code.我的代码有什么问题。 Thank you!谢谢!

Here's my code:这是我的代码:

$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();
}

check if your configuration is write检查您的配置是否写入

$config['smtp_host']    = 'ssl://secure.sample.com';
$config['smtp_user']    = 'no-reply@sample.com';
$config['smtp_pass']    = ********;

I think you can try those points by gmail and then move to your own configuration just for testing your code is fine.我认为您可以通过 gmail 尝试这些要点,然后移动到您自己的配置只是为了测试您的代码是好的。 some times the server might not allow you so don't wast time.有时服务器可能不允许你,所以不要浪费时间。 links for gmail smtp Send email using the GMail SMTP server from a PHP page and Sending email with gmail smtp with codeigniter email library gmail smtp 的链接从 PHP 页面使用 GMail SMTP 服务器发送电子邮件和使用带有 codeigniter 电子邮件库的 gmail smtp 发送电子邮件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CodeIgniter中的AWS SMTP邮件错误(无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。) - 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 3 无法使用 PHP ZC2239A92BDE29F0A00F9173193CC2FE 发送 email。 您的服务器可能未配置为使用此方法发送邮件 - Codeigniter 3 Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method 无法使用 PHP SMTP 发送 email。您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method 无法使用 PHP SMTP 发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using PHP SMTP. Your server might not be configured to send mail using this methods 无法使用codeigniter发送电子邮件-错误:您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using codeigniter-Error:Your server might not be configured to send mail using this method 无法使用 PHP mail() 发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using PHP mail(). Your server might not be configured to send mail using this method 遇到错误无法使用 PHP mail() 发送 email。 您的服务器可能未配置为使用此方法发送邮件 - An Error Was Encountered Unable to send email using PHP mail(). Your server might not be configured to send mail using this method 无法使用 PHP Sendmail 发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method 无法发送AUTH LOGIN命令。 错误:无法使用PHP SMTP发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件 - Failed to send AUTH LOGIN command. Error: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method SMTP错误:220 smtpauth.net4india.com准备就绪无法使用PHP SMTP发送电子邮件。 您的服务器可能未配置 - SMTP error: 220 smtpauth.net4india.com ready Unable to send email using PHP SMTP. Your server might not be configured
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM