Php Codeigniter 3:未通过第三方发送电子邮件
我的webiste托管在infinityfree中,我尝试发送电子邮件,但没有收到任何电子邮件。这是我使用的代码Php Codeigniter 3:未通过第三方发送电子邮件,php,codeigniter,email,web-hosting,Php,Codeigniter,Email,Web Hosting,我的webiste托管在infinityfree中,我尝试发送电子邮件,但没有收到任何电子邮件。这是我使用的代码 $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'xxx', 'smtp_pass' => 'xxx', 'mailty
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'xxx',
'smtp_pass' => 'xxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
// Set to, from, message, etc.
$result = $this->email->send();
我必须在谷歌或我的网站的控制面板中设置一些东西吗?谢谢这是在codeigniter中发送电子邮件的最简单方式
$this->load->library('email');
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
通过使用此代码,您可以检查邮件功能。您还可以学习codeigniter电子邮件类
试试这个
首先,加载库
$this->load->library('email');
$this->email->from('test@abc.com', 'Sender Name');
$this->email->to('to@gmail.com');
$this->email->subject('Sample');
$this->email->message('Email testing');
使用条件检查是否发送电子邮件
if($this->email->send()){
echo 'Scuuess';
}else{
echo 'Fail';
}