-1

I am using ubuntu with xampp. I need to send mail from localhost . I am new to php.Can u help me what are all i need to configure to send mail from localhost?

<?php
$to = "mymail@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "othemail@gmail.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers) or die("unable to send");
echo "Mail Sent.";
?> 

2 Answers2

1

you should try this link to send mail from localhost http://www.mittalpatel.co.in/php_send_mail_from_localhost_using_gmail_smtp

which gives you insight about how to send mail from localhost using third party SMTP server.

Ram Choubey
  • 265
  • 2
  • 12
0

You should send email using SMTP, it will work.
It will work in win32. i am not sure about any other.
Check following link.

Send email from localhost running XAMMP in PHP using GMAIL mail server

Community
  • 1
  • 1
Raghu Goriya
  • 78
  • 1
  • 10