【问题标题】:php mail with PDF attachment header causes to go into just mail带有PDF附件标题的php邮件导致进入邮件
【发布时间】:2012-09-27 04:46:16
【问题描述】:

我有一个生成 PDF 的网络表单,该 PDF 在提交时通过电子邮件发送给我,但电子邮件不断被过滤到垃圾邮件文件夹中。我怀疑电子邮件标题中有问题,但不确定可能是什么。

感谢任何帮助。

以下是sn-p...

// send by email
    $fileatt = '../pdfs/'.$filename;
    $fileatt_type = mime_content_type_manual($fileatt); // File Type  "application/pdf"
    $fileatt_name = $filename; // Filename that will be used for the file as the attachment 

    $email_from = "auth@mysite.com"; // Who the email is from 
    $email_subject = "Auth Report"; // The Subject of the email 

    //$email_to = "info@mysite.com";
    $email_to = "info@mysite.com";

    $headers = "From: ".$email_from; 

    $file = fopen($fileatt,'rb'); 
    $data = fread($file,filesize($fileatt)); 
    fclose($file); 

    $semi_rand = md5(time()); 
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 

    $headers .= "\nMIME-Version: 1.0\n" . 
    "Content-Type: multipart/mixed;\n" . 
    " boundary=\"{$mime_boundary}\""; 

    $email_message .= "This is a multi-part message in MIME format.\n\n" . 
    "--{$mime_boundary}\n" . 
    "Content-Type:text/html; charset=\"iso-8859-1\"\n" . 
    "Content-Transfer-Encoding: 7bit\n\n" . 
    $email_message .= "\n\n"; 

    $data = chunk_split(base64_encode($data)); 

    $email_message .= "--{$mime_boundary}\n" . 
    "Content-Type: {$fileatt_type};\n" . 
    " name=\"{$fileatt_name}\"\n" . 
    "Content-Transfer-Encoding: base64\n\n" . 
    $data .= "\n\n" . 
    "--{$mime_boundary}--\n";

【问题讨论】:

    标签: email pdf header php


    【解决方案1】:

    如果您将电子邮件的发件人(即您的案例的 auth@mysite.com)作为新联系人添加到您的电子邮件客户端的通讯录,那么这封电子邮件可能不会被标记为垃圾邮件,因为它来自您的通讯录成员。

    【讨论】:

    • 谢谢,但是这封邮件被发送给了我以外的许多人,将邮件标记为“非垃圾邮件”确实有效,但是我需要让每个人都这样做或将地址添加到他们的联系,这不是一个合理的解决方案。服务器未列入黑名单,因此电子邮件应在收件箱中发送,但代码有问题,我不确定它可能是什么:/
    猜你喜欢
    • 2015-11-29
    • 2020-11-20
    • 2014-02-28
    • 2011-02-18
    • 2017-09-29
    • 2011-08-25
    • 1970-01-01
    • 1970-01-01
    • 2019-12-26
    相关资源
    最近更新 更多