I am unable to send email from localhost using php script this is my code
<?php
ini_set("SMTP","bhoi@gmail.com");
ini_set("smtp_port","25");
ini_set('sendmail_from', 'bhoi@gmail.com');
//define the receiver of the email
$to = 'deepan@gmail.com';
//define the subject of the email
$subject = 'Test email';
//define the message to be sent. Each line should be separated with \n
$message = "Hello World!\n\nThis is my first mail.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: bhoi@gmail.com\r\nReply-To: bhoi@gmail.com";
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
php.ini file...
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from =bhoi@gmail.com
the out put is "Mail failed"
please help me to solve my problem.
bhoi.test@gmail
is a smtp server - PeeHaa