使用 PHP 发送电子邮件到 Facebook 群组邮件地址
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
电子邮件是否需要来自“[电子邮件受保护]”?因为 Yahoo 邮件使用 SPF,Facebook 可以使用它来验证您的电子邮件实际上并非来自在那里,并丢弃您的电子邮件作为欺骗尝试。
如果电子邮件需要来自[电子邮件受保护],您需要通过 SMTP 连接到 Yahoo 邮件< /a>,并传递您的用户名和密码,然后从那里合法地发送您的电子邮件。
至于图片附件,可以。
编辑:根据可爱的 DaveRandom 的评论,以下 PHP 包应该会让您的工作变得更加容易: PHPMailer 或 SwiftMailer
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