Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a console application that attaches files from a folder on the server and mails it to myself. This works well, but it always seems to put the mails in the Junk email folder. Can anyone tell me what I need to do to send the mails to my inbox instead of the Junk mail folder?

share|improve this question

migrated from Nov 6 '12 at 14:08

This question came from our site for professional and enthusiast programmers.

Have you got any junk email rules configured in your email client/server? – ShellShock Nov 6 '12 at 13:24
Your code isn't putting the email in your Junk folder, a policy on your mail server probably is. What's your email setup? – rie819 Nov 6 '12 at 13:25
Pls post a sample email. Probably there is a pattern that is similar to some junk. – phresnel Nov 6 '12 at 13:26
Junk mail represents a mail which its contents may not change that is sent many times to different users. In this case, the sender of the mail is considered a spammer and all the sender's messages are dropped to the recipient's Junk Folder. Did you try to send the message with a different sender? I believe this may fix the problem. Have a great day :) – user162498 Nov 6 '12 at 13:31
How are you sending? Who are you sending the email from? On the off chance you have sent from a made up address (perfectly possible if the smtp server is valid) the recieving server may decide to check the validity of the sent from address. Doubt this is the answer... but just incase :) – Jammerz858 Nov 6 '12 at 13:54

Each mail client (outlook, gmail, hotmail etc) has its own checklist of things which determine whether a received email is considered spam. Some email clients don't like when you use certain spammy words or large amounts of money in the content. These things can raise your spam score and your email will no longer pass the spam test. Other things that have a negative effect are $ and ! in your text, multiple //// in your code and the word 'free'. It is accumulative, so you're free to use those things, but they add up and may trip some spam filters like Outlook.

Try sending an empty email. If it goes through, it has something to do with your content (which is good because you can always change it).

If it still goes to the spam folder, chances are your IP address has been blacklisted. This is bad. Not sure if changing the 'from' address will help, as it is still being sent from the same location.

share|improve this answer

Be sure to include a full body and subject for the email. There is no 100% guarantee that you can solve this in the sending application, because the decision junk/not junk lies with the receiver. You can only make sure that your mail looks as human as possible.

Furthermore this depends on the server you use to send the mail with. If you have a Gmail account you could use that for sending, which will dramatically decrease the chance of the mail being regarded as spam (I say this from my own experience).

The last option is to mark the sender ( as a safe one inside your email program. This will obviously stop the mail from being put in your Junk folder, but there might be a reason for you not wanting to do that (maybe you want to send it to more people in the future?).

share|improve this answer

It may be that your message is violating some common spam rules, such as embedding raw html, using falgged words, etc.

However, if none of those are the case, then most likely this is because your machine's IP address is not listed in your DNS SPF record. The SPF record is a TXT record added to your domain DNS. If you do not have control of your DNS record than most likely it is always going to be flagged as spam.

If you do have control of your DNS, then I suggest adding your host to your SPF record.

Here is what a typical SPF record looks like:

"v=spf1 ip: -all"

Just add your servers IP address to this and it should not go to your junk folder.

share|improve this answer

You must log in to answer this question.