Got postfix and mail working, but the emails are considered "spam", why?

I have a linux server, with postfix just installed.

I am new to email-servers...

Anyways, I am able to send mail with php:s mail function, but they are considered "spam" by google mail (and probably most other email accounts also, haven't tested hotmail, yahoo etc).

I am guessing it has something to do with SPF, but I don't have a clue what SPF is, how to fix it etc etc...

Can anybody explain how to make my emails "Non-spam" which they are not?

OS is Ubuntu 9.10.

If you need more input let me know...

Thanks

PS: How can I disable all incoming mail to my postfix (email server) without using my firewall, maybe by using main.cf?


Solution 1:

Ok, there's 3 (very different things) you need to be doing to avoid false positives.

  1. Reverse DNS needs to be set-up, so the IP of your server resolves to your server's hostname. You need to ask your hosting provider/netblock owner to do this, you can't do it yourself directly.

  2. SPF. This involves adding an entry to the DNS zone record that your server is part of. It doesn't involve server configuration (unless it's also the nameserver for the domain). SPF generator may help here.

  3. Set-up DKIM on your server. Not too difficult, the dkim-filter package on Debain based systems IIRC, google for a tutorial.

You should also check that your domain and IP isn't on a block list somewhere. You need to google and read a lot as well - postmaster is no easy job.

Also have a look at MX Toolbox.

If you post your servers name, I can give further pointers.

Solution 2:

I suspect your server is on a blacklist: http://www.dnsblcheck.co.uk/

Solution 3:

One common trick for eliminating having your mail marked as spam is to always send mail using valid From: headers.

For example if your hostname is 'bobs-server' and you send a mail using the local mail command (which is what PHP's mail() function does, by default), it will appear to come from something like "apache@bobs-server".

Of course, on the open Internet, bobs-server isn't a real domain and attempts to look up A or MX records for this host will fail. You should give your server (or at least the external IP/NAT it comes from) a valid A record (and/or MX record if you want to accept mail) and then use a from header to match, such as:

From: [email protected]

This will eliminate a lot of hosts regarding your mail as insta-spam. SPF records haven't really been implemented fully on the Internet and aren't commonly used authoritatively for whether or not something is spam.

Hope that helps.

Solution 4:

For Batter Inbox delivery first of all configure and check you mail server configuration specially SPF and DKIM configuration. SPF Configuration: visit: openspf.net DKIM Configuration For Postfix in Ubuntu: https://help.ubuntu.com/community/Postfix/DKIM Testing of DKIM and SPF: http://www.port25.com/domainkeys/

After server configuration and testing please check you ip plack listing and sender score: Ip Blacklisting: mxtoolbox.com/blacklists.aspx Ip Reputation: senderscore.com (used by Yahoo and Aol), commtouch.com (Used by rediff)

After all this if you mail still found in spam then please check keywords of your email body. Check is your From address is valid.