I have installed WAMP on windows 8 and am trying to send emails using sendmail. The code returns "email sent", however, the testemail account does not receive any emails in its inbox or spam folder.
This is my sendmail.ini file.(I have tried 25,587,465 for the smtp_port and ssl,blank,none,tls for the smtp_ssl)
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=mypassword
hostname=localhost
This is the [mail function] of the php.ini file.
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP =localhost
; http://php.net/smtp-port
;smtp_port = 465
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path ="c:\wamp\sendmail\sendmail.exe -t -i"
And this is my php file for sending emails
<?php
$to = '[email protected]';
$subject='testing';
$message = 'This is a test';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to,$subject,$message,$headers))
{
echo "email sent";
}
else
{
echo "Invalid Email";
}
?>
This is what I am getting in my debug log file
14/11/12 12:25:11 ** --- MESSAGE BEGIN ---
14/11/12 12:25:11 ** To: [email protected]
14/11/12 12:25:11 ** Subject: testing
14/11/12 12:25:11 ** X-PHP-Originating-Script: 0:email.php
14/11/12 12:25:11 ** From: [email protected]
14/11/12 12:25:11 ** Reply-To: [email protected]
14/11/12 12:25:11 ** MIME-Version: 1.0
14/11/12 12:25:11 ** Content-type: text/html; charset=iso-8859-1
14/11/12 12:25:11 ** X-Mailer: PHP/5.3.13
14/11/12 12:25:11 **
14/11/12 12:25:11 ** This is a test
14/11/12 12:25:11 ** --- MESSAGE END ---
14/11/12 12:25:11 ** Connecting to smtp.gmail.com:25
14/11/12 12:25:12 ** Disconnected.
14/11/12 12:25:12 ** Disconnected.
14/11/12 12:25:12 ** Socket Error # 10061<EOL>Connection refused.
I have tried googling for the solution and also set my sendmail.exe to run with administrator privileges. I have also enabled IMAP access on [email protected]. Can anyone help me with this?