Sending email through php/sendmail (Win all) 1.7.7 [SOLVED]
Posted: 06. November 2011 12:48
Using xampp 1.7.7 on windows vista
I am trying to create a registration module where the user will receive an email upon registration.
I am trying to use google's smtp server for that purpose
these are the changes that i have made in php.ini
Below is a part of send mail.ini
Finally this is the php file that i am trying to run
when i use the port 586
the page only displays "see" but the recipients have not received any mail
but when i use port 465
the page keeps on loading forever and nothing happens.
I need to know what I'm doing wrong and how to fix it
I am trying to create a registration module where the user will receive an email upon registration.
I am trying to use google's smtp server for that purpose
these are the changes that i have made in php.ini
- Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 465
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Below is a part of send mail.ini
- Code: Select all
smtp_server=smtp.gmail.com
; smtp port (normally 25)
smtp_port=465
; 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
smtp_ssl=auto
default_domain=google.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=mygmailid@gmail.com
auth_password=mygmailpassword
Finally this is the php file that i am trying to run
- Code: Select all
<?php
$to='reciever@gmail.com';
$subject='mysub';
$message='messagebody.';
$headers = 'From: mygmailid@gmail.com' . "\r\n" .
'Reply-To: mygmailid@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to,$subject,$message,$headers);
echo 'see';
?>
when i use the port 586
the page only displays "see" but the recipients have not received any mail
but when i use port 465
the page keeps on loading forever and nothing happens.
I need to know what I'm doing wrong and how to fix it