我有下面的代码无法发送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'),但是错误消息清楚地告诉“为什么”。 –