my php code sending mail
is:
$email_to="deepuskmr@gmail.com"; $email_subject="it works"; $email_message="hello. can send mail!"; $headers = "from:dpu\r\n". "reply-to: sdeepu.kmr@gmail.com\r\n'" . "x-mailer: php/" . phpversion(); mail($email_to, $email_subject, $email_message, $headers); echo "mail sent!"
but code not sending email. gives error.
my php.ini file settings
[mail function] ; win32 only. ; http://php.net/smtp smtp = localhost ; http://php.net/smtp-port smtp_port = 25 ; win32 only. ; http://php.net/sendmail-from sendmail_from = sdeepu.kmr@gmail.com
i working in localhost
. , using windows 64
machine.
you using localhost
mail server, if did not installed 1 (smtp server), returns cannot connect.
you should have :
[mail function] ; win32 only. ; http://php.net/smtp smtp = smtp.gmail.com ; http://php.net/smtp-port smtp_port = 587