使用 PHP 发送电子邮件到 Facebook 群组邮件地址

发布于 2024-12-27 19:28:34 字数 786 浏览 1 评论 0原文

1,我尝试用 PHP 向我的 Facebook 群组电子邮件发送电子邮件,但这些更新并没有不出现。如果我从我的 yahoo 邮箱 发送电子邮件,它会立即发布。我应该在邮件标头中添加哪些类型的信息?

2、是否可以添加图片作为附件

我当前的邮件发件人代码是:

<?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.";
?>

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.";
?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最好是你 2025-01-03 19:28:34

电子邮件是否需要来自“[电子邮件受保护]”?因为 Yahoo 邮件使用 SPF,Facebook 可以使用它来验证您的电子邮件实际上并非来自在那里,并丢弃您的电子邮件作为欺骗尝试。

如果电子邮件需要来自[电子邮件受保护]您需要通过 SMTP 连接到 Yahoo 邮件< /a>,并传递您的用户名和密码,然后从那里合法地发送您的电子邮件。

至于图片附件,可以

编辑:根据可爱的 DaveRandom 的评论,以下 PHP 包应该会让您的工作变得更加容易: PHPMailerSwiftMailer

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文