Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Php mail() function not sending emails.

Hey guys, I am trying to send a mail from php using the mail() function using sendmail but it is not being delivered. Here is the sample code that I am trying.

    $email = $_POST['email'];
    $from_add = ""; 

    $to_add = "$email"; //<-- put your yahoo/gmail email address here

    $subject = "Test Subject";
    $message = "Test Message";

    $headers = "From: $from_add \r\n";
    $headers .= "Reply-To: $from_add \r\n";
    $headers .= "Return-Path: $from_add\r\n";
    $headers .= "X-Mailer: PHP \r\n";

        $msg = "Mail sent OK";
       $msg = "Error sending email!";
    <title>Test form to email</title>

<?php echo $msg ?>
<form action='<?php echo htmlentities($_SERVER['PHP_SELF']); ?>' method='post'>
    <input type="email" name="email">
    <input type="submit" name="submit" value="GO">


In the php configuration file, the sendmail path is set to /usr/sbin/sendmail -t -i. If you guys need any more information, I'll post it.


This discussion has been closed.