How to generate app password on Gmail to send emails via Linux Terminal

Endrit Qerreti

Endrit Qerreti

In this tutorial you will learn how to configure Gmail to send emails via mail utility on Linux.

1) Login to your Gmail Account

2) Click " Manage your Google account"

3) Go to Security Section

4) Navigate to "2 Step Verification"

Authenticate by using your password

5) Go to App Passwords

Scroll down to the end of page and you should see "App password" section, click on it

6) Generate App Password

Choose Other(Custom) on Select App and choose a name for the app, this can be anything you want.

Once you set the name click Generate and you should see the generated password as shown on the image below

This is the password that you need to set on the ssmtp.conf file

7) Configure ssmtp

Copy the generated password and paste it to AuthPass in the ssmtp.conf

root=postmaster
mailhub=smtp.gmail.com:587
hostname=OwlHowTo
AuthUser=email
AuthPass=password <- the generated password
FromLineOverride=YES
UseSTARTTLS=YES

Conclusion

In this tutorial you learned how to generate an app password on Gmail for configuring the ssmtp.conf on Linux.