0

PHP script

$from = "xyz@gmail.com";
$to = "xyz@yahoo.com";
$subject = "subject";
$mailtext = "blablabla";
if (mail($to, $subject, $mailtext, "From: $from "))    
{    
  echo "Enquiry sent!";    
}else {
  echo "fail!";    
}

When I run the code it displays enquiry sent which means mail is sent but the mail is not recieved .

Deepesh
  • 6,138
  • 1
  • 24
  • 41
  • 1
    Most likely this is because you are on a localhost and without configuring a mail server or using something like phpmailer or another lib you won't be able to send out mails. – Epodax Jul 21 '15 at 08:21
  • Can you please share the configuration or any details on the same because i have already done the configurations in the localhost sendmail.ini and php.ini – user3005758 Jul 21 '15 at 08:27
  • php's sendmail isn't a mail server, you either need to install a mail server (as mentioned before) or use something similar to phpmailer (google it). – Epodax Jul 21 '15 at 08:32

1 Answers1

0

Cause you can not send email from localhost. It stored as text file to simulate sending email .

Sam
  • 1,424
  • 13
  • 28