笨发送电子邮件是进入垃圾邮件箱使用Amazon EC2的
问题描述:
这是我的代码:笨发送电子邮件是进入垃圾邮件箱使用Amazon EC2的
$config = array(
'protocol' => 'smtps',
'smtp_host' => 'ssl://smtps.googlemail.com',
'smtp_user' => '[email protected]',
'smtp_pass' => '******',
'smtp_port' => '465',
'mailtype' => 'html',
'smtp_timeout' => '4',
'newline' => "\r\n"
);
$this->email->initialize($config);
$this->email->to('[email protected]');
$this->email->cc();//$this->input->post('cctxt')
$this->email->from('[email protected]');
$this->email->subject('Test subject');
$this->email->message('Test message');
$this->email->send();
echo $this->email->print_debugger();
此电子邮件进入垃圾邮件箱。
答
首先,你必须在谷歌的SMTP Server的错误,它必须看起来像
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_user' => '[email protected]',
'smtp_pass' => '******',
'smtp_port' => '465',
'mailtype' => 'html',
'smtp_timeout' => '4',
'newline' => "\r\n"
);
$this->email->initialize($config);
$this->email->to('[email protected]');
$this->email->cc();//$this->input->post('cctxt')
$this->email->from('[email protected]');
$this->email->subject('Test subject');
$this->email->message('Test message');
$this->email->send();
echo $this->email->print_debugger();
然后,对于这个工作,你必须启用在您的谷歌帐户的安全应用程序访问,因为你不使用OAUTH。
Enable access For less Secure Apps
祝您好运!
+0
否当我使用此配置aaray。邮件发送停止。我的服务器是https,所以我需要使用smtps。现在我的问题是为什么它在垃圾邮件 –
错误显示无法验证密码。确保你使用正确的登录凭证 – BSB
哪个托管你使用.... cpanel或windows – Mahesh
登录凭据是正确的。 @BSB –