I am actually new in using sendmail but I have read a lot about this, and only redirect me to use PHPmailer,swiftmailer etc... But it's so complicated to understand without the knowledge of the basics. So I decided to try simple, and this is what I've got.
I have configured my php.ini:
[mail function]
smtp_port = 465
sendmail_path="C:\wamp\sendmail\sendmail.exe -t"
mail.add_x_header = On
And my sendmail.ini:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=
error_logfile=error.log
debug_logfile=debug.log
auth_username=mygmail@gmail.com
auth_password=mypassword
hostname=localhost
and I have this PHP code:
$to = 'mygmail@gmail.com';
$message = $_POST['message'];
$email = $_POST['email'];
$contact_num = $_POST['contact_number'];
$headers = 'From:'.'$email' . "\r\n" .'$contact' . "\r\n" .
'Reply-To: mygmail@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $message, $headers);
but whenver i click the submit button the sendmail.exe appears and nothing happens. And when I check the error.log it says:
14/07/01 23:23:48 : Connection Closed Gracefully.