SSMTP configuration in Ubuntu 18.04 with Bash in my own system (one user)
First, I recommend set -eu early in the script to abort on errors and to make any use of unset variables be an error.

Second, If HOSTNAME is unset, we probably want to fallback to running the hostname command.  There seems little point in assigning it to a variable we use only once:

# (simplified to show only the relevant part)
cat &lt;&lt;EOF
    hostname=${HOSTNAME:-$(hostname)}
EOF


Then we can delete the line myHostName="$HOSTNAME", as it's no longer used.

Third, the other thing missing is umask 077 to ensure that the file isn't created readable by anyone else (important, as it contains cleartext credentials).



When reading email address, it shouldn't be necessary to hide it using read -s - only the password ought to be a secret.

When reading the password, there's no need to mention that confirmation is not required, as we wouldn't normally expect it here: we use confirmation when creating a password (so the user doesn't accidentally lock herself out of her account by a simple invisible typing error).  Here, we're entering an existing password, and any error can be corrected just by re-running the script.



Edited script

Applying my suggestions, we get:

#!/bin/bash

set -eu

umask 077  # Ensure others can't read the file

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 &amp;&amp; echo

cat &lt;&lt;-EOF &gt; /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