This is how I configure the utility SSMTP that allows me to send mail via smtp
protocol through a Google-Gmail proxy instead I'll have to manually configure an "heavier" Postfix bi-directional email server on my environment. I configure it in my own server environment that only I uses.
#!/bin/bash
myHostName="$HOSTNAME"
read -sp "Please paste your Gmail proxy email address (due to pasting, no verfication needed): " gmail_proxy_email_address && echo
read -sp "Please paste your Gmail proxy email password (due to pasting, no verfication needed):" 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=${myHostName}
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
EOF
Would you do this even otherwise? Something to shorten? Some alternative utility maybe?