Question

How To Setup Up Email Sending Authentcation with my server?

I want my server to authenticate all outgoing emails from my server. At the domain provider, I record the SPF record and the authentication works perfectly. However, I also want my server to authenticate outbound mail from even a gmail email address. I sent the mail with PHPMailer and gave it a try, but when I read the mail, gmail prompts me that the email may not have been sent by the sender. The email header is not encrypted. For other email providers, I see that their own server authenticates even if they use gmail email addresses. What do I need to do to have my server authenticate outgoing mail from my server (including using a gmail email address). I want to build a newsletter sending service. Of course, I do not want to commit fraud and unethical activities. Customers can only use specific email addresses after they have previously activated it. So the email will only be used by the rightful owner of the email address. I just don’t know how to get my server to authenticate when sending these emails


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

One way to do this would be to setup a MTA agent like Postfix as described in this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-20-04

But before doing so, I would mention two things:

  • In some cases, port 25 is closed for new accounts. It is best to use port 587 or 465 instead.
  • I would also suggest reading this post on why you might not want to run and manage your own email server:

https://www.digitalocean.com/community/tutorials/why-you-may-not-want-to-run-your-own-mail-server

An alternative option would be to use a managed SMTP service like SendGrid for example. They have a free plan that is sufficient for a lot of the use cases.

Best,

Bobby