imgrooot Posted April 13, 2019 Share Posted April 13, 2019 Say I have an email info@website.com created in cPanel on a web hosting company. I want to send email notifications to users on my website. I am using PHP Mailer to send the emails. But all the emails go directly into their junk box/spam folder, unless they confirm that info@website.com is not junk. I am wondering if there is a work around for this? Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/ Share on other sites More sharing options...
gw1500se Posted April 13, 2019 Share Posted April 13, 2019 Not really. It is entirely dependent on the recipient's filter. Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566056 Share on other sites More sharing options...
ginerjm Posted April 13, 2019 Share Posted April 13, 2019 Is the 'from' address in the email a valid address of your domain name? Meaning, if you are paying a host to serve your domain/website and to handle emails for that same domain name, then the emails you send have to use that domain name in the "from" header of the email. That's the way it is always explained here. Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566058 Share on other sites More sharing options...
mac_gyver Posted April 13, 2019 Share Posted April 13, 2019 check your DNS records at tools.dnsstuff.com start with the DNSreport tool. Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566060 Share on other sites More sharing options...
chhorn Posted April 15, 2019 Share Posted April 15, 2019 (edited) If i could mark an email as "not spam" myself i could use that to send actual spam. makes no sense. Edited April 15, 2019 by chhorn Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566109 Share on other sites More sharing options...
NotionCommotion Posted April 15, 2019 Share Posted April 15, 2019 The content of the email can influence whether it will get through the recipients filter. For instance, I wrote and manage a bid solicitation application which sends emails out to one to around ten individuals per transaction, and all at once, emails mysteriously started going to the recipient's junk folder. I later discovered that in the body of the emails, there was a HTML link using HTTPS, however, the destination of the link no longer supported HTTPS but only HTTP which resulted in being blocked by some filters. Also, the quality of your email host can influence whether tagged as spam. Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566116 Share on other sites More sharing options...
gizmola Posted April 16, 2019 Share Posted April 16, 2019 I'd just be repeating information I've provided numerous times for other similar questions. It's an art with some science and there are no guarantees, however, there are numerous things you can do, some of which aren't all that difficult, but most of which are more system and domain administration tasks. Here's one of those recent threads: Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566130 Share on other sites More sharing options...
taquitosensei Posted April 16, 2019 Share Posted April 16, 2019 If your domain's reverse lookup isn't setup correctly that could cause this. If the spf records aren't configured correctly. If the return address isn't a valid e-mail, ie you haven't created it yet on your mail server. It could be any of those and more. E-Mail is very finicky. Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566135 Share on other sites More sharing options...
ginerjm Posted April 16, 2019 Share Posted April 16, 2019 Since nothing seems to be happening with this topic, let me ask this: Can you post the php code that is setting up your email headers for us to review? I basically want to see what the from address is set to since you never actually confirmed that for us. Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566136 Share on other sites More sharing options...
imgrooot Posted April 16, 2019 Author Share Posted April 16, 2019 5 hours ago, ginerjm said: Since nothing seems to be happening with this topic, let me ask this: Can you post the php code that is setting up your email headers for us to review? I basically want to see what the from address is set to since you never actually confirmed that for us. Suere thing. Here is my code setup for sending emails. $from_name = 'MyWebsite'; $from_email = 'info@mywebsite.com'; $user_email = 'user@email.com'; $post_subject = 'Hello World'; $post_message = 'It was a dark and stormy night...'; // Multiple recipients $send_to = $user_email; // Subject $subject = $post_subject; // Message $message = " <html> <body> <p>{$post_message}</p> </body> </html> "; // To send HTML mail, the Content-type header must be set $headers[] = 'MIME-Version: 1.0'; $headers[] = 'Content-type: text/html; charset=iso-8859-1'; // Additional headers $headers[] = 'From: '.$from_name.' <'.$from_email.'>'; // Mail it mail($send_to, $subject, $message, implode("\r\n", $headers)); Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566146 Share on other sites More sharing options...
gw1500se Posted April 17, 2019 Share Posted April 17, 2019 As I said earlier, it is really a function of the filters set up by the mail reader or user. The best you can do, as others are suggesting, is to make sure your From and DNS information are complete and correct. You cannot control what the user has set up as a content filter. Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566152 Share on other sites More sharing options...
ginerjm Posted April 17, 2019 Share Posted April 17, 2019 It appears that your from address is correct, assuming that you are actually using a domain that your server recognizes. BTW - Earlier you stated that you were using PHPMailer yet the code you just posted is NOT using PHPMailer. What happened? Quote Link to comment https://forums.phpfreaks.com/topic/308585-is-there-a-way-to-have-the-email-sent-from-the-server-not-end-up-in-junk-mail/#findComment-1566157 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.