php – 使用Codeigniter发送邮件

它是我的控制器

    $to = "goeboekimutcs@gmail.com";
    $subject = "Goeboek I-Mut";
    $content = "<html><body><p>Test Content</p></body></html>";
    $headers = "From: goeboekimutcs@gmail.com";
    mail($to, $subject, $content, $headers);

这是我的PHP.ini

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailBox (sendmail.exe in the sendmail folder)
sendmail_path = "\"D:\Programs\xampp\sendmail\sendmail.exe\" -t"

; XAMPP: Comment out this if you want to work with mailTodisk, It writes all mails in the D:\Programs\xampp\mailoutput folder
; sendmail_path="D:\Programs\xampp\mailtodisk\mailtodisk.exe"

这是我的sendmain.ini

smtp_server=smtp.gmail.com

; smtp port (normally 25)

smtp_port=587
auth_username= goeboekimutcs@gmail.com
auth_password= **

我在我的浏览器上打开我的控制器,加载后,我刷新我的Gmail,但没有电子邮件来…有时它发送,但往往不发送.发生什么事?

解决方法:

最好使用一些第三方库来发送像PHPMailer这样的电子邮件,这可以为您节省很多麻烦.您需要做的就是设置一些初始配置.

您可以在此处获取最新更新以及用法

PHPMailer Github link

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...