I have the following configuration setup in XAMPP:
In php.ini
:
[mail function]
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = *******@gmail.com
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"
I also have the php_openssl.dll
extension activated in here.
In sendmail.ini
:
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=*****@gmail.com
auth_password=******
force_sender=************@gmail.com
smtp_ssl=auto
However, I can't send any mail with this configuration.
This is the Debug.log
output:
19/06/15 00:01:39 ** --- MESSAGE BEGIN ---
19/06/15 00:01:39 ** To: ********@gmail.com
19/06/15 00:01:39 ** Subject: Hello from XAMPP!
19/06/15 00:01:39 ** From: *****@gmail.com
19/06/15 00:01:39 **
19/06/15 00:01:39 ** This is a test
19/06/15 00:01:39 ** --- MESSAGE END ---
19/06/15 00:01:40 ** Connecting to smtp.gmail.com:587
19/06/15 00:01:41 ** Connected.
19/06/15 00:01:44 << 220 smtp.gmail.com ESMTP r88sm6899147pjb.8 - gsmtp<EOL>
19/06/15 00:01:44 >> EHLO ASUS<EOL>
19/06/15 00:01:44 << 250-smtp.gmail.com at your service, [103.220.204.137]<EOL>250-SIZE 35882577<EOL>250-8BITMIME<EOL>250-STARTTLS<EOL>250-ENHANCEDSTATUSCODES<EOL>250-PIPELINING<EOL>250-CHUNKING<EOL>250 SMTPUTF8<EOL>
19/06/15 00:01:44 ** Authenticating as ******@gmail.com
19/06/15 00:01:44 >> STARTTLS<EOL>
19/06/15 00:01:45 << 220 2.0.0 Ready to start TLS<EOL>
19/06/15 00:01:45 >> QUIT<EOL>
19/06/15 00:01:45 <<
For some reason, it is going straight to QUIT<EOL>
after STARTTLS<EOL>
instead of the authentication commands.There's also a lot of garbage output after in the response after the QUIT<EOL>
command.
Here's a snapshot of the garbage output: debug.log
The mail sending script is as follows:
<?php
$to = '*******@gmail.com';
$subject = 'Hello from XAMPP!';
$message = 'This is a test';
$headers = "From: ******@gmail.com\r\n";
if (mail($to, $subject, $message, $headers)) {
echo "SUCCESS";
} else {
echo "ERROR";
}
which always returns ERROR.
How do i solve this issue? Same configuration works in two of my friends machines.