电子邮件发送我已经上传我的托管服务器上的源不工作后,我的代码如下:发送电子邮件使用CodeIgnitor从托管服务器
function sendMail($code,$email)
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'something',
'smtp_timeout' => '4',
'mailtype' => 'text',
'charset' => 'utf-8'//'iso-8859-1'
);
$message = 'Your Verification code is :'.$code;
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]',"iSec Community"); // change it to yours
$this->email->to($email);// change it to yours
$this->email->subject('Activate your account');
$this->email->message($message);
if($this->email->send())
{
return true;
}
else
{
show_error($this->email->print_debugger());
return false;
}
}
我试图使这项工作,一些工作,但他们发送垃圾邮件不是在收件箱中,有的根本不能工作:
1 - 改变'protocol' => 'sendmail'
[失败]
2 - 改变'smtp_host' => 'smtp.gmail.com'
或 'smtp_host' => 'ssl://smtp.gmail.com'
或 'smtp_host' => 'ssl://smtp.googlemail.com'
或 'smtp_host' => 'smtp.googlemail.com'
所有[失败]
3 - 改变'smtp_port' => 587
或'smtp_port' => 25
[失败]
4 - 在我的谷歌电子邮件我已经允许Less Secure Apps
,Disabled 2 Step Verification
[失败]
5 - 评论/删除$config
变量[SUCCESS]但电子邮件被发送到垃圾邮件与下面用黄色背景 This message may not have been sent by: [email protected]
警告请建议我我应该怎么做,我想,现在超过10个小时,现在发送电子邮件。
没有什么,我的文件在现场托管的服务器上,在xampp代码中工作正常,但现在不是 –
确定只有第一个字母大写,例如'Example。 php'和'class Example使用CI3版本扩展CI_Controller {}'这是必须的。它可能是你的提供者,可能是这个问题? – user4419336
yup @ wolfgang1983这是我的类名看起来像'User extends REST_Controller' –