簡體   English   中英

如何確保發送的電子郵件不會進入垃圾郵件?

[英]How can I make sure that sent emails do not land in Spam?

我現在正在使用以下代碼,但是,電子郵件會發送到垃圾郵件箱,請幫助我修復此錯誤

<?php    
$to = "youremail@gmail.com";
$subject = "mail with attachment";    
$att = file_get_contents( 'name.pdf' );
$att = base64_encode( $att );
$att = chunk_split( $att );    
$BOUNDARY="anystring";    
$headers =<<<END
From: Your Name <abc@gmail.com>
Content-Type: multipart/mixed; boundary=$BOUNDARY
END;

$body =<<<END
--$BOUNDARY
Content-Type: text/plain    
See attached file!    
--$BOUNDARY
Content-Type: application/pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="your-file.pdf"    
$att
--$BOUNDARY--
END;    
mail( $to, $subject, $body, $headers );

?>

請幫助我解決此錯誤

謝謝

嘗試使用MIME版本的標頭

$headers.= "MIME-version: 1.0\n";
$headers.= "Content-type: text/html; charset= iso-8859-1\n";

進入垃圾郵件箱相對於:

  • 學科
  • 發件者姓名
  • 發件人電子郵件

它的作用就像信譽一樣,如果您出於測試目的使用“ abc@gmail.com”,那么無論使用什么代碼,您都有很大的機會進入垃圾郵件箱!

至少嘗試使用真實的電子郵件進行測試,例如您自己的電子郵件

使用https://www.mail-tester.com/測試您的電子郵件垃圾郵件分數。 該網站還將為您提供有關如何改善郵件的提示。 如果您對郵件測試人員退回的某些問題有任何疑問,請在此處張貼,我將為您解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM