Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Email Help

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42672
    alexmccabe
    Participant

    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 = ’[email protected]’;
    $subject = $topic;
    $message = $message;
    $headers = ‘From: ‘ . $name . “rn” .
    ‘Reply-To: ‘ . $email . “rn” .
    ‘X-Mailer: PHP/’ . phpversion();

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

    Message successfully sent!

    “);
    } else {
    echo(“

    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.

    #124186
    SgtLegend
    Member

    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.

    #124198
    Paulie_D
    Member

    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.

    #124217
    __
    Participant

    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., `[email protected]`).

    [`mail()`](http://php.net/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)
  • The forum ‘Back End’ is closed to new topics and replies.