How do I encrypt outgoing system emails via GPG on ubuntu 14.04?

Posted April 8, 2015 4.4k views
NginxUbuntuPHPSecurityEmailSystem Tools

I’m running a simple HTML website on Ubuntu 14.04 managed by Serverpilot (NGINX).
The form on my (forced SSL) website uses a simple PHP mailer to send visitor messages to my external email account.
Is there a way to encrypt all form entries via GPG (or PGP) before sending it to my external email account?

P.S.: I don’t mind if your method makes all system mails encrypted by default.


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.

Submit an Answer
1 answer

I was able to locate a couple options for you to do this:

  • An answer here suggests using GNU Anubis to encrypt emails but this may require using SMTP for your sending rather than the php mail() function.
  • The answer to this question demonstrates how to encrypt the content of your message in PHP before sending it using GnuPG.
  • Thank you very much for your swift response!
    I will read into this - since I have no idea which solution is easier to integrate in my existing form template.