Gmail gets mail but not hotmail and its not in spam folder either

October 28, 2013 6.2k views
Hi! I have some problem sending mail from my LAMP installation. The server is used to host different websites. Its a ubuntu 13.04 droplet. 1. I have installed the program sendmail, and didnt do any kind of configuration on that. Using the standard config. 2. I have setup MX record for my DNS inside digital ocean control panel as with priority 10 3. When sending a mail by php. I get the mail to gmail but sometimes it goes to spam. In hotmail and my DNS mail client the mail doesnt come in at all.... 4. I looked at the raw mail from gmail and it outputs something like this: Authentication-Results:; spf=neutral ( XXX.XXX.XXX.XXX is neither permitted nor denied by best guess record for domain of my_server_user@localhost.localdomain) smtp.mail=my_server_user@localhost.localdomain my_server_user - Is the user that runs my php script. Should that really be visible here? XXX.XXX.XXX.XXX - Is my ip number localhost.localdomain - shouldnt that be the url of where the php script is running. 5. Further googling i found this page to check my ip number if its blacklisted. And it was listed in the CBL. With the respond: "This IP address is HELO'ing as "localhost.localdomain". 6. My /etc/hosts file looks like this: localhost localhost.localdomain Akuma What configurations should I do to make it work? My droplet is named I have no idea how to solve this. I have tried google for days, been trying solve this problem to long with no luck... Hope someone can help me on this... I'm completely lost.... Thanks!
21 Answers
The DigitalOcean LAMP tutorials are missing a section on setting your machine's FQDN. Check out Setting the Hostname & Fully Qualified Domain Name (FQDN) on Ubuntu 12.04 | GitHub.

You should also implement: How To use an SPF Record to Prevent Spoofing & Improve E-mail Reliability.
by Pablo Carranza
A carefully tailored SPF record will reduce the likelihood of your domain name getting fraudulently spoofed and keep your messages from getting flagged as spam before they reach your recipients.
Hi and thanks for your reply!

Okey so I followed your links. But damn, it doesnt work. Still no mail to hotmail and spam in gmail...

I did this steps:

1. In the /etc/hosts file. It looks like this:
–––––––––––––––––––––––––––––––––––– localhost.localdomain localhost Akuma
195.xx.xx.x34 Akuma

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

2. sudo sendmailconfig
3. sudo service apache2 restart

I have already a TXT record at my dns provider with: "v=spf1 mx a ip4:193.xx.xx.x34 ~all"

Gmail says that email was sent from Akuma but it should be sent from my virtual host site I mean, can I setup all my virtualhosts urls connected to the ip in the /etc/hosts, and it automatically check and send the email as the virtualhost? Hope you understand me.

But its strange that hotmail doesnt even get my email...

(Akuma and is a dummy name for writing here, but it has the same case format)

Any ideas? Really appreciate your time and help!
Try restarting your entire droplet, first: sudo reboot now;

Then, verify that your SPF record is correct @ SPF Wizard.
Hi again!

I did "sudo reboot now". And now I cant connect to the droplet... I have waited for 10 min. How long should it take for it to reboot?
Yikes! It shouldn't take that long. Are you still not able to connect? Have you tried logging in via the console through the D.O. Control Panel?

What a coincidence, Digital Ocean had server issues in different locations. When I rebooted. But now its up running again phue :)

Still not working... Still coming to spam in gmail and not coming in to hotmail....

Here is my RAW output of the where I noticed localhost.localdomain
Received: from (localhost.localdomain [])
by (8.14.4/8.14.4/Debian-2.1ubuntu2) with ESMTP id r9SLB2nA001375
for ; Mon, 28 Oct 2013 22:11:02 +0100
Received: (from my_server_user@localhost)

What are your thoughts?

I used your SPF Wizard (and im a total newbie on that) I got this as result: IN TXT "v=spf1 a ?all"

Do you think that is the problem?

Thanks for your help!

RE: the SPF Wizard,

Are you not originating mail from the hosts that are the subject of your MX records? If you are, then change Do the MX handlers also originate email for this domain? to Yes.

Change How stringent should SPF-aware MTA's treat this? to Soft fail.

What's the output of hostname -f?
Okay, now I got this: IN TXT "v=spf1 mx a ~all"
Should I add it to the DNS provider?

The result after "hostname -f" is:

"Should I add it to the DNS provider?"

Ok, I have now added it. Lets wait until it propagates. Will come back withing an hour.
Just to mention, i had this before "v=spf1 mx a ip4:193.xx.xx.x34 ~all"

Talk to you soon! Thanks for your help!! :)
Out of curiosity, why did you elect to deploy sendmail as opposed to Exim or Postfix?
by Etel Sverdlov
Postfix is a free, open source Mail Transfer Agent which works to route and deliver email. Here we'll help you install and setup Postfix on an Ubuntu 12.04 VPS.
God morning! :)

Still not working when I updated the SPF record...

I have no favor. I followed a tutorial to send mail and it happend to be sendmail.
I looked at Exim. I will try to install that, if not working I will try Postfix. Will let you know my result!

Super thanks!


I tried Exim. Same result, spam folder in gmail. Hotmail there is no mail in spam or inbox
I tried Postfix. Same result, spam folder in gmail. Hotmail there is no mail in spam or inbox

Now I have Postfix installed in my ubuntu....

What am I doing wrong, dont understand... Is my IP flagged for spam or something similar?

Thanks for your help!
Where are you managing your DNS? I wonder if the problem is not necessarily on your end, but w/the configuration of your current DNS provider.

Also, re: your SPF record, "v=spf1 mx a ip4:193.xx.xx.x34 ~all"

Who's IP address is that? And why does it not have an A record or CNAME?
All my DNS:names are at I have talked to them to also investigate if its there problem.

Look at these screendumps:
"v=spf1 mx a ip4:193.xx.xx.x34 ~all" It's my droplets ip. Im using xxx just not to spoil my ip. I changed the SPF record yesterday to "v=spf1 mx a ~all" as you suggested. is a temporary place where I put the images. Its not my droplet ip and its not at Digital Ocean. Dont get confused with that ip :)

Looking at the screendump, looks everything allright?
Hello again! I talked to my DNS provider and asked if they can look if they find my mail in there spam filter. They find it and the error was that my Ip was blocked. As I mentioned before. So visiting this link and the i pushed the button to remove my ip from the list. It will take 1-2 hours before it will be completely erased. I will come back with result!
Yes, it works!! Phu...
So the problem was that I didnt setup my hostname properly before I sent out the first mail. My hostname was localhost.localdomain a typical spam attacker. So my ip was blacklisted in hotmail and my DNS provider email.

The solution if people have the same problem:
1. Go to
2. Type in your ip
3. If it finds that your ip is blacklisted. You can see what the problem is. In my case my hostname was localhost.localdomain. So you need to change that and also in you mail client. My result was
4. Scroll down the page and press the button to resolve your ip.
5. Wait 1-2 hours and BOOM its done! :)

Want to thank you Pablo of vDevices for all your help!! You cant imagine how appreciated I am for helping me out, your expertise and time... Thanks alot! Postfix is simpler than sendmail, thanks for the tip! :)

Wow! Glad you got it straightened out!
am also working the same , still am not get email to inbox , getting in spam in gmail

i did 1. rename host
2. configured spf

still email comes in spam , please help me
@tnav077346: See if robertbadas's solution above fixes it.
Have another answer? Share your knowledge.