Server Fault is a question and answer site for system and network administrators. 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

There may well be a better solution to this problem, and I welcome those as well.

At the moment, I have an e-mail form on my website where people can send an e-mail directly to my gmail account through a PHP script. However, when I receive those e-mails, sometimes gmail flags it as possibly spam or phishing; presumably because the e-mail didn't come from a known server.

I was just wondering if there was anyway to tell gmail that if it comes from my server, it is safe. I thought that maybe I could add a unique custom header and tell gmail that that means it's a safe source?

I'm not very familiar with the deeper complexities of e-mail and e-mail servers, so any help would be much appreciated.

share|improve this question
You could start by creating the appropriate SPF record in your DNS zone. – joeqwerty Aug 4 '13 at 23:52
up vote 1 down vote accepted

Configure your application code to use a SMTP relay service, rather than sending the emails yourself.

Sendgrid springs to mind, as a possible alternative, but there are many alternative SMTP as a Service solutions.

As you're using Amazon EC2 already, it's definitely worth investigating Amazon Simple Email Service (SES) which has a very generous free tier allowance.

share|improve this answer
Are there any free alternatives to Sendgrid? This is just a personal, non-commercial website for use as an online CV/Resume. – Luke Aug 4 '13 at 22:05
I googled for 'free SMTP relay' and found a whole bunch with free tiers. There's also a free tier on Amazon Simple Email Service... – Tom O'Connor Aug 4 '13 at 22:30
You can use your own Gmail account as a relay. Just setup an application specific password, and use the settings they give you. – Butters Aug 5 '13 at 1:32
You can, but they have hard sending limits, which aren't that high. – Tom O'Connor Aug 5 '13 at 8:34
It looks like Amazon SES is perfect for me, as I am already using an EC2 instance to host the site anyway.. the first GB of e-mails per month costs nothing, and there is absolutely no way I would expect to get that many. So, I will accept this as the answer. Thanks! – Luke Aug 5 '13 at 9:06

Your Answer


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.