codeigniter - 在 codeigniter 上发送电子邮件失败且没有错误
问题描述
在过去的几个小时里,我试图理解为什么我的脚本没有发送电子邮件。
在生成电子邮件内容的最后,我使用此代码发送它
if ($this->email->send())
{
//all is fine
}
else
{
//we have a problem
}
每次所有的想法似乎都正常时,电子邮件地址、内容等在任何情况下都不会返回失败的 send() 命令。
它会导致什么或我如何才能更接近问题?
在我的服务器日志文件中,我也看不到一些想法。
希望有人有想法...
有没有办法输出所有当前的电子邮件设置?
解决方案
试试这个它通过本地主机为我工作
function sendMail()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'xxx@gmail.com', // change it to yours
'smtp_pass' => 'xxx', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = '';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('xxx@gmail.com'); // change it to yours
$this->email->to('xxx@gmail.com');// change it to yours
$this->email->subject('Resume from JobsBuddy for your Job posting');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
}
推荐阅读
- c++ - 用于 ASCII 的环绕式 c++
- vba - Set a sub-form hidden field to visible, based on a check box status
- haskell - 如何将 Haskell 异常用于索引负数
- python - 使用 Pandas 更改标签行
- eclipse - Eclipse dark theme bug after uninstalling
- javascript - 防止mouseleave函数中断mouseenter
- python - Rentry to numpy 函数返回错误:float object has no attribute exp
- css - 如何在没有绝对定位的情况下将文本放在图像上
- android - 使用 Kotlin 将特征写入 BLE 设备
- python - 连接两个池化层的特征