1

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

任何帮助表示赞赏。

以下是一个片段...

// 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";
4

1 回答 1

0

如果您将电子邮件的发件人(即您的案例的auth@mysite.com)作为新联系人添加到您的电子邮件客户端的地址簿中,则该电子邮件可能不会被标记为垃圾邮件,因为它来自成员您的联系地址簿。

于 2012-10-06T02:50:40.860 回答