开发者

Sent mail from my site to members appears as spam

开发者 https://www.devze.com 2023-04-06 06:57 出处:网络
I have a site and I want to email the active code to my new members. I have an unique IP too, but when I send an email with \"Mail\" function in PHP, the email would appear on their Spam. How can I se

I have a site and I want to email the active code to my new members. I have an unique IP too, but when I send an email with "Mail" function in PHP, the email would appear on their Spam. How can I send the email to my members that appear on their Inbox??

$headers = "From: info@mysite.com\r\n";
$headers .= "Reply-To: info@mysite.com\r\n";

if ( mail("myemail@gmail.com","Test","Hello,world !",$headers) ) {
   echo "T开发者_Go百科he email has been sent!";
   } else {
   echo "The email has failed!";
   }


Most email hosts, have a system which favor "Normal text", in received e-mails. Any type of emails with unusual letters have a greater tendency of ending up in the spam-filter. Try to take a look at what the e-mail your sending them actually looks like, and see if there's anything that might appear "unusual".


Try this...

$to = "emailaddress@tosendto.com";
$subject = "Put Subject Here";
$message = "Put at least a paragraph of text";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html\r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$headers .= "From: info@mysite.com\r\n";
$headers .= "Reply-To: info@mysite.com\r\n";

if ( mail($to,$subject,$message,$headers) ) {
    echo "The email has been sent!";
} else {
    echo "The email has failed!";
}

Make sure that the email address that the emails are being sent from, exists.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号