简体   繁体   English

如何通过PHP向Yahoo发送电子邮件

[英]How to send email to yahoo via PHP

I am attempting to send a confirmation email from a PHP script. 我正在尝试从PHP脚本发送确认电子邮件。 I tested on gmail and it worked fine (the email was sent with appropriate subject and contents), however when I tried sending an email to a yahoo account, the subject field was correct but the contents were sent as an attachment as opposed to text inside the actual email. 我在gmail上进行了测试,并且工作正常(电子邮件已发送适当的主题和内容),但是当我尝试向yahoo帐户发送电子邮件时,主题字段正确,但是内容以附件形式发送,而不是内部文本实际的电子邮件。 Here is the mailing code. 这是邮递区号。

$headers = 'From: ' . 'orders@COMPANY_NAME.com' . "\r\n";
    $headers .= 'Reply-To: ' . 'orders@COMPANY_NAME.com' . "\r\n";
    $headers .= "BCC: orders@COMPANY_NAME.com \r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text; charset=ISO-8859-1\r\n"
mail($email, "COMPANY_NAME Order Confirmation $confirmation_number", $text, $headers);

How can I send an email to yahoo that will include $text inside the email as opposed to an attachment? 如何发送电子邮件到yahoo,其中在电子邮件中包含$ text而不是附件?

It may be because of a wrong "Content-Type" header: I do not think "text" is a valid content type. 可能是因为“ Content-Type”标头错误:我认为“ text”不是有效的内容类型。
You should try, instead, with "text/plain". 您应该改为使用“文本/纯文本”。

Content-Type: text/plain; charset=ISO-8859-1

PS: you may also want to consider using UTF-8 instead of ISO-8859-1. PS:您可能还想考虑使用UTF-8而不是ISO-8859-1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM