Sending mail from a contact form. Simple but challenging!

Posted by ekalaivan on Stack Overflow See other posts from Stack Overflow or by ekalaivan
Published on 2010-05-03T15:22:11Z Indexed on 2010/05/03 15:28 UTC
Read the original article Hit count: 220

Filed under:
|

I've set up a contact form in the Greet Us page in http://swedsb.com

When I submit the form, it says mail sent successfully. But I'm not getting the mail, checked the spam folder.

I've set a similar form at http://ibsolutions.in. It is working perfectly.

Been breaking my head for the past 4 hours. Here's my contact.php

<?phpif(isset($_POST['submit'])) {

    $to = "[email protected]";
    $subject = $_POST['posRegard'];
    $name = $_POST['posName'];
    $email = $_POST['posEmail'];
    $message = $_POST['posText'];
    $body = "$name has sent you a greeting. \n E-Mail: $email\nMessage:\n $message";

    mail($to, $subject, $body);
    header( 'Location: http://swedsb.com/' );
 } 

else {echo "blarg!";}?>

© Stack Overflow or respective owner

Related posts about php

Related posts about contact-form