yudijohn
yudijohn

Reputation: 1278

Send Mail With Codeigniter

its my controller

    $to = "[email protected]";
    $subject = "Goeboek I-Mut";
    $content = "<html><body><p>Test Content</p></body></html>";
    $headers = "From: [email protected]";
    mail($to, $subject, $content, $headers);

it's my 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"

it's my sendmain.ini

smtp_server=smtp.gmail.com

; smtp port (normally 25)

smtp_port=587
auth_username= [email protected]
auth_password= **

i open my controller at my browser, after loading, i refresh my gmail but no email come.. sometimes it send but often not send. what happen?

Upvotes: 4

Views: 368

Answers (1)

Abhinav
Abhinav

Reputation: 8168

It is better to use some third party library for sending emails like PHPMailer which saves you a lot of headaches. All you need to do is set some initial configurations.

You can get the latest update here and also the usage:

PHPMailer Github link

Upvotes: 1

Related Questions