-1

I was trying to send mail by php, the function mail returns 1, but i didn't get the mail in my inbox

if (isset($_POST["firstName"]) == false)
        return;
    $to = "mymail@mail.com";
    $subject = $_POST["subject"];
    $message = $_POST["content"];
    $headers = 'From: ' . $_POST["email"] . "\r\n" .
    'Reply-To: ' .  $_POST["email"] . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
    $from = "From: " . $_POST["firstName"] . " " . $_POST["lastName"] . " <" . $_POST["email"] . ">";
    echo mail($to, $subject, $message, $headers);
    echo '<script type="text/javascript">alert("sent message succesfully");</script>';
E.T.
  • 1

1 Answers1

-1

Using PHP's mail() function it's possible. Remember mail function will not work in Local server.

<?php
$to      = 'abc@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: admin@example.com' . "\r\n" .
   "CC: somebodyelse@example.com";

mail($to, $subject, $message, $headers);
?> 

Reference:

http://php.net/manual/en/function.mail.php