Using Gmail for sending smtp mail

Written by Robert -

Before doing any of this, make sure you allow unsafe applications to use your gmail account. I cannot advise you doing this with your normal e-mail account. You should only do this with an account dedicated for this purpose, because of the dangers of having SMTP open.

After being logged in, you can change this by going here:

I assume you have the ssmtp package installed on your system. You need to edit the file called /etc/ssmtp/ssmtp.conf

# The user that gets all the mails  
# The mail server  
# The address where the mail appears to come from for user authentication.  
# The full hostname. You need to use a FQDN or localhost  
# Use TLS before starting negotiation  
# Google requires the use of starttls  
# Your e-mail address as your username  
# Your password as your password  
# Email 'From header's can override the default domain?  
# Your certificate bundle  

Please verify that your bundle is in that location.

A note on passwords with ssmtp

There has been a bug for many years regarding special characters in ssmtp passwords. Especially with passwords like 123#456, where a pound sign is added, it won't parse this properly towards the server. I personally advice to use longer passwords, like DKDbxnx2fy9zTQEdgxxUqBLm instead. There are several password generators online that can assist you with creating a password like this.