Mails marked as spam in Gmail

I have installed Apache James to handle e-mails on my server. It works fine when I’m sending both through telnet and PHP’s native mail() function. The problem is that when I’m sending to a Gmail address, the mail will be marked as spam. When I send the EXACT same mail with the EXACT same headers with a PHP script on a web hosting service (one.com), the mail goes straight to the inbox. This is the reason why I think it’s not the headers or PHP that is the problem. And my IP address shouldn’t be in a blacklist, because I have never sent any mail from here before.

Anyone who think they know what can cause this kind of problem?

And my IP address shouldn’t be in a blacklist, because I have never sent any mail from here before.

I think we might have a winner here. Do you have reverse DNS setup for this domain? That will set alot of things off.

I have read more on the subject now, and as you say this is probably the problem. I have contacted my ISP now, so we’ll have the answer quite soon.

Is it a shared or dedicated server?

Hello,

Get reverse DNS set to your Mail server IP …also make sure you set SPF record for your domain to avoid this problem.