• # February 18, 2013 at 7:15 pm

    Hi all!

    I want to use the contact form which Chris is created and when I click on send button the message comes and tells “The message has been sent successfully” but actually I don’t get any emails.

    # February 18, 2013 at 7:36 pm

    This reply has been reported for inappropriate content.

    Simple questions, but important:

    What type of server are you running it on? (Apache, windows?)

    Are you running it on a “live” server, or from a personal (local) installation?

    Are you sure you are not sending emails? If you are on apache with valid PHP, on a real live server that is actually capable of sending email (your local installation probably won’t be if that’s what you’re doing), then it could be that your email is being filtered out by your spam filter.

    # February 19, 2013 at 11:18 am

    I’m on apache server now and using the script in live server.

    I also checked my spam folder but nothing is there.

    I thought it could because of I didn’t touch “$EmailFrom = “”;”
    then I change it to mine but again it didn’t work.

    Please help!

    # February 19, 2013 at 12:37 pm

    This reply has been reported for inappropriate content.

    Does PHP’s mail() work correctly?

    $to = ‘’;
    $subject = ‘the subject’;
    $message = ‘hello’;
    $headers = ‘From:‘ . “rn” .
    ‘Reply-To:‘ . “rn” .
    ‘X-Mailer: PHP/’ . phpversion();

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

    Change to your own email and the bit of to your own domain name.

    # February 19, 2013 at 5:06 pm

    Do you have PHP installed on the server? Or just Apache? It will not work with out PHP.

    # February 19, 2013 at 5:33 pm

    This reply has been reported for inappropriate content.

    If PHP were not installed, I doubt the application would appear correctly. He’d see php tags, for a start, and probably wouldn’t see a “The message has been sent successfully” message.

    # February 19, 2013 at 5:54 pm

    I have these lines:

    $EmailFrom = “”;

    $EmailTo = “”;

    $Subject = “Nice & Simple Contact Form by CSS-Tricks”;

    $Name = Trim(stripslashes($_POST));

    $Subject = Trim(stripslashes($_POST));

    $Email = Trim(stripslashes($_POST));

    $Message = Trim(stripslashes($_POST));

    but yours is different from mine I think.

    # February 19, 2013 at 6:17 pm

    Why don’t you just use a script that does work right out of the gate?

    # February 19, 2013 at 6:29 pm

    This reply has been reported for inappropriate content.


    Yes, mine is different from yours. That’s because I want you to isolate components of the application in order to work out where it is going wrong.

    The script I posted uses the mail() function and some variables and nothing else. If it doesn’t work, then the problem is somewhere in that function. If that works, then the problem is elsewhere.

    The application works. I have installed it on my own domain and I receive emails fine. Therefore there is something on your end that is different.

    To test my script, create a blank php file (call it testmail.php or something), copy the code I posted into it and save it into your domain. Then visit the script. mail() will then be used as expected and you can see if you receive the email.

    # February 20, 2013 at 6:28 pm


    which script for example?


    I didn’t get exactly what to do. I want to use the mail script as chris’s and show a message for success or error after sending mails.

    # February 20, 2013 at 7:19 pm

    This reply has been reported for inappropriate content.

    I want to use the mail script as chris’s and show a message for success or error after sending mails.

    I understand that. But you say you have uploaded the scripts onto the server and when you complete the form it gives you the success message, but you don’t receive the email.

    I am trying to help you establish what isn’t working. You say you are on an actual server and I assume it is running PHP fine. Mail isn’t being filtered out as spam and I know that Chris’ scripts (here) work on my server, so the fault isn’t with them.

    The only function that I can see being a problem is mail(), as everything else is string manipulation or would lead to an error and wouldn’t (I think) have produced the “Your message has been sent!” feedback when you use it.

    So, I posted code above that cut out a lot of code so that you could test, on its own, whether mail() was working on your server. All I want you to do is save that code in a PHP file (on your server) then visit the page. You won’t see anything in your browser, but it should send an email to the address you enter. If it doesn’t, we know the problem is with the mail() function and you’ll probably need to talk to your web host about resolving it. If it does work, we can dig deeper into why the script isn’t working for you.

    # February 20, 2013 at 7:46 pm

    Post complete code here so we can see script in its entirety. From the code sample you provided it is unclear if you are passing variables to the mail() function correctly.

    # February 20, 2013 at 9:35 pm

    You could try your hand at mine I put together…

    # February 21, 2013 at 7:24 am


    I uploaded the file mail.php holding your codes on my hosting but it didn’t work then I decided to check in another hosting and it worked. So as you said it was about my hosting and I should talk with the moderators to see what they can do for me.

    Thank you so much for these kind helps! I really apperciate your work.

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.