[英]Confirmation email goes into spam not in inbox
我正在PHP注冊頁面上使用SMTP Gmail發送電子郵件以進行帳戶驗證。 我的電子郵件發給垃圾郵件,但我希望它們在收件箱中,而不是垃圾郵件中。 這是我的代碼SMTP.php文件
<?php
include "class.phpmailer.php"; // include the class name
$query1="select * from user";
$res = $conn->query($query1);
function mail_send($to,$user_id,$from="mbtc.neha123@gmail.com")
{
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug=1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth=true; // authentication enabled
$mail->SMTPSecure='ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host="smtp.gmail.com";
$mail->Port=465; // or 587, 465
$mail->IsHTML(true);
$mail->Username ="youremail";
$mail->Password ="yourpassword";
$mail->SetFrom($from,"YourCoin");
$mail->Subject = "Verify your Account for YourCoin";
$mail->Body = "<b>Hi,$to<br/>
<br/>You have Sucessfully Registered.Please Click this Link for verification
<a href='http://yourcoin.me/verify_reg.php?
do=verify&user_id=$user_id'>http://yourcoin.me/verify_reg.php?
user_id=$user_id/</a></b>";
$mail->AddAddress($to);
$mail->CreateHeader();
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
//echo "Message has been sent";
return true;
}
}
?>
請檢查代碼並幫助我糾正此錯誤。 感謝和問候內哈
這里沒有任何“技術上的錯誤”,對於一個郵件帳戶來說,“垃圾郵件”對另一個郵件帳戶來說可能“對”,這很大程度上取決於哪個反垃圾郵件和用戶的個人資料/偏好設置...
就是說,我會嘗試最明顯的檢查:
1)更改郵件主題
2)在正文中添加一些更具描述性的文本
3)確定要使用HTML嗎? 用純文本可以實現相同的效果,請嘗試一下。
4)嘗試發送確認代碼,避免直接鏈接到郵件正文中
5)為無法單擊鏈接的用戶添加某種后備,例如:“如果直接鏈接在您的郵件客戶端上不起作用,請將其直接復制並粘貼到瀏覽器的位置”(或類似的東西)
6)添加信息,以防郵件被意外發送到錯誤的地址“如果您不要求注冊... bla bla bla”
7)如果反垃圾郵件添加了幾行說明為何被視為“垃圾郵件”的內容,請檢查郵件頭。
我不得不說,考慮到我本人會把主題/主題/文本視為“垃圾郵件”,因此我對您的郵件最終被放置在垃圾郵件文件夾中並不感到驚訝。
希望能幫助到你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.