Jump to content

Is there a way to have the email sent from the server not end up in junk mail?


imgrooot

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:  

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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));

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.