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.
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.