Give help. Get help.

  • # February 12, 2013 at 6:31 am

    Hey guys, I was wondering if anyone had any experience with this. I am trying to send an email using PHP’s mail function.

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

    if (mail(“$to”, “$subject”, “$message”, “$headers”)) {

    Message successfully sent!

    } else {

    Message delivery failed…


    I constantly get ‘Message successfully sent!’, yet I get no emails in my inbox. I have tried several recipient emails and nothing.

    # February 12, 2013 at 7:41 am

    Check your spam folder as pretty much all email clients that see an email without X-Spam headers will move it into spam straight away.

    # February 12, 2013 at 7:59 am

    Can you see them in your ‘Outbox’ or ‘Sent Items’?

    Obviously there must be some record of the messages being sent. If there isn’t, then regardless of any ‘Success’ message, they aren’t actually leaving the building.

    # February 12, 2013 at 10:08 am

    In the code you show above, `$name` is not defined: if the “From” header you construct is blank, the email probably won’t be sent.

    Further, if you’re simply putting a name in the “From” header, the mail might be dropped anyway, since “From” requires an email address. Use an email that belongs to your domain (e.g., ``).

    [`mail()`]( wouldn’t know about such a failure: all it does is submit the message to the mailing queue.

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

You must be logged in to reply to this topic.