我有下面的代碼無法發送AUTH LOGIN命令。錯誤:530 5.7.0必須發出STARTTLS命令第一
ini_set("SMTP","ssl://smtp.gmail.com");
ini_set("smtp_port","587");
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = '587';
$config['_smtp_auth']=TRUE;
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'password';
$config['smtp_timeout'] = '60';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = "html";
$this->email->initialize($config);
$this->email->from('[email protected]', 'Sender');
$this->email->to('[email protected]');
$this->email->subject('This is my subject');
$this->email->message('This is the content of my message');
if (! $this->email->send())
{
show_error($this->email->print_debugger());
}
else
{
echo('DONE');
}
但代碼執行的時候,我收到以下錯誤
Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. qd9sm8462833pbb.31
我已經使用
$this->load->library('email');
在我的控制器的構造函數。但我無法從本地主機發送電子郵件。什麼可以是發送電子郵件的解決方案?我需要做些什麼改變?
它看起來像你的代碼試圖提供超過純文本SMTP,不使用TLS或SSL安全連接。 –
@RomanR。如何使用TLS或SSL安全連接? –
我沒有「如何」部分的答案(特別是'php'),但是錯誤消息清楚地告訴「爲什麼」。 –