![](/img/trans.png)
[英]Laravel Markdown - Emails sent to gmail address being marked as spam
[英]Emails only seem to being sent to gmail
我正在使用一些代碼將數據發送到數據庫,該數據庫還會將確認電子郵件發送到在表單字段中輸入的電子郵件地址
由於某些奇怪的原因,它似乎只發送到我的Gmail帳戶,而沒有其他郵件,例如hotmail tiscali yahoo
這是我用來發送電子郵件的代碼
// this send the receiver an email with the link to their ecard
mail("$receiveremail","Somebody loves you !", "<img src=\"http://www.somebodylovesyou.co.uk/images/email-header.jpg\" width=\"300\" height=\"57\">
</p>
<p>Hello $name,</p>
<p>Someone you know has sent you a secret valentine's message from http://www.somebodylovesyou.co.uk </p>
<p>You can view your message here : <a href='http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid'>http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid</a></P>
<P>Why not send a special someone a secret valentine's message at http://www.somebodylovesyou.co.uk</p>
<P>Happy Valentines", $headers);
// this send the receiver an email with the link to their ecard
mail("$youremail","View the message you've just sent", "<img src=\"http://www.somebodylovesyou.co.uk/images/email-header.jpg\" width=\"300\" height=\"57\">
</p>
<p>Hello,</p>
<p>Thanks for using Somebody Loves You </p>
<p>You can view the message you sent here : <a href='http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid'>http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid</a></P>
<P>Happy Valentine's", $headers);?>
有人建議我也使用這些標頭來幫助發送電子郵件,但似乎不起作用
// these headers are for the purpose of sending the email replay to hotmail and yahoo addresses
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: SOMEBODY LOVES YOU <hello@somebodylovesyou.co.uk>\r\n";
$headers .= "Reply-To: <hello@somebodylovesyou.co.uk>\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409\r\n";
$headers .= "X-Mailer: Microsoft Outlook Express 6.00.2800.1409";
試試SwiftMailer,它非常易於使用並且非常強大
$body = "<img src=\"http://www.somebodylovesyou.co.uk/images/email-header.jpg\" width=\"300\" height=\"57\"> </p> <p>Hello $name,</p> <p>Someone you know has sent you a secret valentine's message from http://www.somebodylovesyou.co.uk </p> <p>You can view your message here : <a href='http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid'>http://www.somebodylovesyou.co.uk/viewcard.php?rand=$eid</a></P> <P>Why not send a special someone a secret valentine's message at http://www.somebodylovesyou.co.uk</p> <P>Happy Valentines</p>";
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($subject)
->setFrom(array("hello@somebodylovesyou.co.uk" => "SOMEBODY LOVES YOU"))
->setTo(array($receiveremail))
->setBody($body, 'text/html');
$mailer->send($message);
聽起來這與您的代碼無關。 如果郵件到達的是一個郵件提供商,而不是另一個郵件提供商,則其他提供商將其阻止或將其標記為垃圾郵件。
此時,您要檢查確保正確設置MX記錄和其他DNS記錄以標識您的服務器。
您的域/ IP也可能已被列入黑名單。 在這種情況下,每個郵件提供商都可以采取一些步驟來擺脫其黑名單。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.