我的模型:
<?php
class email_model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
public function sendEmail($from = null, $to = null, $subject = null, $message = null){
$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'utf-8';
$config['mailtype'] = 'html';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('email@mydomain.com', 'Website name');
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
}
}
我的域托管在 GoDaddy 上,我还在那里创建了一封电子邮件并将其重定向到我的 gmail 电子邮件...
为什么我的电子邮件被发送到垃圾邮件文件夹而不是收件箱?
编辑:我的电子邮件内容基本上是欢迎邀请
Hello $email
$website has invited you to join the website
to join visit the following link
$link_goes_here
Thanks, the team