Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have tried understanding SPF but the terms used are beyond my experience, so I turn to you guys now.

I have a Virtual private server (VPS) which I manage myself.

I have installed postfix on it, and have a server named:

  server1.domain.se

Now, the IP of my VPS is for example this:

   111.111.11.1

Then I have my DOMAIN registered at an ISP, where I can manually setup my own DNS Records.

I have these records setup (IP REPLACED WITH "111.111.11.1"):

NAME            TYPE     DATA
www.domain.se    A   111.111.11.1    
domain.se        A   111.111.11.1    
server1.domain.se A   111.111.11.1   
domain.se        TXT v=spf1 a mx ptr ~all

When I send email using php:s mail function the emails are considered spam by gmail, hotmail, and all other email-servers. Why is this?

Here is how I send the mail in php:

$mail_message= "THE MESSAGE GOES HERE";
$headers="MIME-Version: 1.0"."\n";
$headers.="Content-type: text/plain; charset=UTF-8"."\n";
$headers.="From: Domain <no-reply@domain.se>"."\n";
$subject="Subject goes here";

mail($email, '=?UTF-8?B?'.base64_encode($subject).'?=', $mail_message, $headers, '-fno-reply@domain.se'); 

Above, the email adress no-reply@domain.se doesn't even exist, just so you know.

I am as I said before very new to email servers, so please explain in detail how to solve this...

If you need more input, like my postfix configuration or something, just let me know.

Thanks

share|improve this question

4 Answers 4

up vote 1 down vote accepted

I'd try to learn why mail is getting blocked. Try setting up a test email account on Hotmail and send to that account. If it ends up in the spam folder, view the raw message with full headers. Often spam filters will append header information about the rules that caused the system to think it was spam.

Assuming you have root access to the machine, I'd run tcpdump to look at the transaction when you send your test message. Usually the MTA at the other end will provide you the reason for the block.

tcpdump -s 0 -w - port 25 | strings
share|improve this answer

defining spf is not the ultimate solution; use a rDNS, as somebody suggested earlier, lookup your ip in the RBL's on the internet - see www.anti-abuse.org for example consider installing domain keys for yahoo/gmail to accept your emails under (almost) any situations (bulk mail, etc)

and if you want a hands-on approach, post your postconf -n output

share|improve this answer
    
SPF does nothing at all to prevent email sent by you being marked as spam. That's not what it was designed for. It is useful for mail providers to be able to verify that email claiming to be from you is actually from you. No one else will be able to send email using an email address @domain.se to a provider that uses SPF. –  Ladadadada Nov 2 '10 at 14:00

Have you set up RDNS with your ISP? A lack of a reverse pointer is the most common reason for mail to be considered spam by other servers.

share|improve this answer
    
I have the settings you can see above... Thats it. –  Anonymous12345 Sep 25 '10 at 20:24
    
I see a txt and a couple of A records, just no PTR record. If you do a host command on your IP, does it return your domain? –  MaQleod Sep 25 '10 at 20:58
    
Sorry for the late response. When I do a host on the IP, I get the email-servers name as a response (server1.domain.se) –  Anonymous12345 Sep 26 '10 at 14:41
    
Since RDNS is setup, you now need to check central blacklists, which most major ISPs will reference, you can check common blacklists using this tool: mxtoolbox.com/blacklists.aspx. It would also help to know exactly what the bounce error message is saying (error codes and all). –  MaQleod Sep 27 '10 at 19:00

Relay via your ISP's mail server. Configure your mail server to forward all outgoing messages to it until you have resolved your issues,

Until you get your PTR record pointing back to your domain you are likely to have problems. You will have to arrange this with your ISP. Do you have a static IP address, if not you shouldn't be trying to send directly to the Internet, and risk loosing incoming email.

Also check what your server thinks it name is this should be server1.domain.se. If it just says server1, or 111.111.11.1 you are not likely to be able to send email to many servers.

Read the bounce messages you get, as they may provide a clue as to why you were classified as spam. Also check your IP address at spamhaus.org. If you are blocked there, you will have problems with many servers. There are other sites that will check multiple blacklists for you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.