簡體   English   中英

電子郵件似乎僅發送給gmail

[英]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";

從技術上講,Gmail與該協議的任何其他電子郵件服務完全相同,因此我認為這不是與代碼相關的問題。

我要檢查的是您的傳出電子郵件服務器和域,尤其是兩件事:

這些是防止電子郵件偽造的技術。 某些電子郵件服務將自動拒絕沒有SPF和DKIM的任何郵件。

試試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.

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