Codeigniter停止从wamp服务器windows 10上的gmail smtp发送邮件
我发布的代码在2个月内运行良好。现在,出于某种原因,它停止了发送邮件Codeigniter停止从wamp服务器windows 10上的gmail smtp发送邮件,smtp,gmail,windows-10,wamp,codeigniter-2,Smtp,Gmail,Windows 10,Wamp,Codeigniter 2,我发布的代码在2个月内运行良好。现在,出于某种原因,它停止了发送邮件 $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'system@gmail.com',
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'system@gmail.com',
'smtp_pass' => 'xxxxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
//za da mi ispraka na sevisniot mail i da mozam da sledam dali ispraka izvestai dokolku oni stiklirale isprakanje
$this->email->clear(TRUE); //za reset pred sekoe novo prakanje od jamkata
$this->email->set_newline("\r\n");
$this->email->from('doNotReply', '');
$this->email->to('service@gmail.com');
$this->email->subject($subjectStart . ' izvestaj');
$this->email->message('');
$this->email->attach('D:/wamp64/www/dica/assets/iEksel/'. $filename);
if ( ! $this->email->send()){
$myfile = fopen("mail.txt", "a") or die("Unable to open file!");
$txt = $this->email->print_debugger();
fwrite($myfile, $txt);
fclose($myfile);
}
调试器将输出以下错误:
遇到以下SMTP错误:0无法发送数据:AUTH LOGIN
无法发送AUTH LOGIN命令。错误:
无法发送数据:邮件发件人:
发件人:遇到以下SMTP错误:
无法发送数据:RCPT到:到:遇到以下SMTP错误:
无法发送数据:数据数据:遇到以下SMTP错误:
无法发送数据:用户代理:CodeIgniter 无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件
有人知道为什么这段代码在两个月内运行良好,但现在却无法运行吗?服务器端不需要这段smtp代码。 对于服务器端,这么多代码就足够了:$this->load->library('email'); $config['mailtype'] = 'html'; $this->email->initialize($config); $this->email->to($this->input->post('emailtxt')); $this->email->cc($this->input->post('cctxt')); $this->email->from($fromEmail['user_email']); $this->email->subject($this->input->post('smailtxt')); $this->email->message($this->input->post('tamailtxt')); $this->email->attach($pathfile); $this->email->send();
对于客户端,您使用的代码看起来很有用。问题必须是smtp用户电子邮件和密码是否更改或检查wamp中的php.ini文件。服务器端不需要此smtp代码。 对于服务器端,这么多代码就足够了:$this->load->library('email'); $config['mailtype'] = 'html'; $this->email->initialize($config); $this->email->to($this->input->post('emailtxt')); $this->email->cc($this->input->post('cctxt')); $this->email->from($fromEmail['user_email']); $this->email->subject($this->input->post('smailtxt')); $this->email->message($this->input->post('tamailtxt')); $this->email->attach($pathfile); $this->email->send();
对于客户端,您使用的代码看起来很有用。问题必须是smtp用户电子邮件和密码被更改或检查wamp中的php.ini文件。而不是smtp在数组中使用smtps$config = Array( 'protocol' => 'smtps', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'system@gmail.com', 'smtp_pass' => 'xxxxxxx', 'mailtype' => 'html', 'charset' => 'iso-8859-1' );
在阵列中使用smtps代替smtp$config = Array( 'protocol' => 'smtps', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'system@gmail.com', 'smtp_pass' => 'xxxxxxx', 'mailtype' => 'html', 'charset' => 'iso-8859-1' );
这就是我在php.ini中看到的,可以吗?:SMTP=localhost SMTP\u port=25应该是这样的:SMTP=SMTP.gmail.com SMTP\u port=465 sendmail\u from=something@exmple.comsendmail\u path=“\”E:\sendmail\sendmail.exe\“-t”在sendmail/sendmail.ini中,文件是这样的:smtp_server=smtp.gmail.com smtp_port=465 smtp_ssl=auto force_sender=something@example.comBut之前,我没有在php.ini中更改任何内容。我做了codeigniter的所有配置,就像我之前解释的那样。那么,为什么在成功工作了2个月后,它停止工作了呢?我还注意到,无论我写的是什么值:“smtp_用户”=>”system@gmail.com'和'smtp_pass'=>'xxxxxxx',我仍然收到相同的错误。从上面localhost中的更改来看,它正在工作。必须进行此更改。这是我在php.ini中的设置,可以吗?:SMTP=localhost SMTP_port=25应该是这样的:SMTP=SMTP.gmail.com SMTP_port=465 sendmail_from=something@exmple.comsendmail\u path=“\”E:\sendmail\sendmail.exe\“-t”在sendmail/sendmail.ini中,文件是这样的:smtp_server=smtp.gmail.com smtp_port=465 smtp_ssl=auto force_sender=something@example.comBut之前,我没有在php.ini中更改任何内容。我做了codeigniter的所有配置,就像我之前解释的那样。那么,为什么在成功工作了2个月后,它停止工作了呢?我还注意到,无论我写的是什么值:“smtp_用户”=>”system@gmail.com'和'smtp_pass'=>'xxxxxxx',我仍然收到相同的错误。从上面localhost中的更改来看,它正在工作。这一改变是必须的。