I did not know how to use sendmail.exe but I read that I need it to send email.
I tried this one
<?php
$to = 'xxx@yahoo.com';
$subject = 'Test email';
$message = "Hello World!\n\nThis is my first mail.";
$headers = "From:xxx@yahoo.com\r\nReply-To: xxx@yahoo.com";
$mail_sent = @mail( $to, $subject, $message, $headers );
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
but I get mail failed. What should I do to make sendmail.exe work?
This is my sendmail.ini:
smtp_server=smtp.gmail.com
; smtp port (normally 25)
smtp_port=587
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify
default_domain=gmail.com
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging
error_logfile=error.log
; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging
;debug_logfile=debug.log
; if your smtp server requires authentication, modify the following two lines
auth_username=xxx@gmail.com
auth_password=xxx
; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines
pop3_server=
pop3_username=
pop3_password=
; to force the sender to always be the following email address, uncomment and
; populate with a valid email address. this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content
force_sender=gmail.com
; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required
;hostname=