Search code examples
phpfacebookemailsocial-networkingsendmail

Send e-mail with PHP to Facebook group mail address


1, I tried to send e-mail in PHP to my Facebook group email, but these updates, doesn't appear. If I send the e-mail from my yahoo mail, it posted instantly. What kind of information should I add to the mail header?

2, Is is possible to add images as attachments?

My current mail sender code is:

<?php
    $to = "[email protected]";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "[email protected]";
    $headers = "From:" . $from;
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
?>

Solution

  • Does the email need to come from "[email protected]"? Because Yahoo mail uses SPF, which Facebook can use to verify that your email didn't actually come from there, and discard your email as a spoofing attempt.

    If the email needs to come from [email protected], you'll need to connect to Yahoo mail through SMTP, and pass your username and password through, and legitimately send your email from there.

    As for image attachments, it's possible.

    EDIT: As per the lovely DaveRandom's comment, the following PHP packages should make your job MUCH easier: PHPMailer or SwiftMailer