我想使用CodeIgniter通過我的Gmail地址發送電子郵件。 我嘗試了很多解決方案,但都沒有工作。如何使用CodeIgniter發送Gmail電子郵件
我的代碼:
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'yyyyy',
'mailtype' => 'html',
'charset' => 'utf-8',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->from('[email protected]', 'admin');
$this->email->to('[email protected]');
$this->email->subject('Email test');
$msg = "Testing email.";
$this->email->message($msg);
$this->email->send();
echo $this->email->print_debugger();
我有以下錯誤:
Message: fwrite(): send of 5 bytes failed with errno=32 Broken pipe
Filename: libraries/Email.php
和
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
就目前而言,我'在本地主機的工作。
謝謝你幫助我。
我想你沒有讓你的Gmail帳戶使用SMTP的。你需要檢查你的谷歌SMTP設置。 – kishor10d