Reputation: 8130
This seems like something fairly straightforward and my php script is able to execute. However I am never receiving the mail. Here is the relevant code:
php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
; http://php.net/smtp-port
;smtp_port = 25
sendmail_path = "C:\xampplite\sendmail\sendmail.exe -t -i"
sendmail.ini
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
default_domain=mydomain.com
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=passpass
[email protected]
hostname=smtp.gmail.com
Is there anything here I'm missing? My script is sending email to myself. That wouldn't be a problem right?
<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Upvotes: 3
Views: 14002
Reputation: 82
Try this
sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=ssl
error_logfile=error.log
debug_logfile=debug.log
auth_username=[email]@gmail.com
auth_password=[email password]
pop3_server=
pop3_username=
pop3_password=
force_sender=[email]@gmail.com
force_recipient=
hostname=smtp.gmail.com
php.ini
[mail function]
SMTP = smtp.gmail.com
smtp_port = 465
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header=Off
Upvotes: -1