On Debian LAMP with different PHP based CMSs I use the MTA sSMTP to send email via an email proxy (Gmail); the emails I send are only contact-form inputs transferred from any such CMS to my own email account:
CMS contact-form input → Eail proxy (Gmail) → Main email account I use (also Gmail)
My sSMTP conf looks similar to this:
#!/bin/bash
set -eu
read -p "Please paste your Gmail proxy email address: " \
gmail_proxy_email_address
read -sp "Please paste your Gmail proxy email password:" \
gmail_proxy_email_password && echo
cat <<-EOF > /etc/ssmtp/ssmtp.conf
root=${gmail_proxy_email_address}
AuthUser=${gmail_proxy_email_address}
AuthPass=${gmail_proxy_email_password}
hostname=${HOSTNAME:-$(hostname)}
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
EOF
As you can see a file named /etc/ssmtp/ssmtp.conf will be created and will contain the email address and its account's password.
If the unlikely happens and an hacker finds out the email address and password I could be in a lot of trouble in cases I store payment information (I don't, I never did, and not planning to but still, it should be taken seriously).
How could I protect the aforementioned file? Maybe encrypting it somehow?
As of the moment I don't want to use an email server with configuring email DNS records, etc.