How to use Gmail as your SMTP server for Youtrack?

I was using 2-Step Verification on my Gmail Account and this caused an error sending an email. To resolve first I created an App Password (see: https://support.google.com/accounts/answer/185833)

NOTE: to be able to create an App Password it's absolutely necessary to enable 2-Step Verification in your google account. If you don't do it, you'll receive a message indicating that your account doesn't support App Passwords.

Then using these settings I was able to send a test email:

  • SMTP host: smtp.gmail.com
  • SMTP port: 465 ;
  • Mail protocol: SMTP+SSL
  • SMTP login: [email protected]
  • SMTP password: #newly created app password# ;
  • Select SSL key: No key ;
  • Server 'from' email: [email protected].

Here is what I finally did:

  1. SMTP host: smtp.gmail.com ;
  2. SMTP port: 465 ;
  3. Mail protocol: SMTP+SSL ;
  4. SMTP login: [email protected] or [email protected] ;
  5. SMTP password: ****** ;
  6. Select SSL key: No key ;
  7. Server 'from' email: [email protected].

Gmail will ignore the from parameter so I put the same.

References

  • Enable IMAP in your Gmail settings (Gmail doc) ;
  • How to use Gmail as your SMTP server.

The other two answers are correct, but are alternatives:

  • if your google account is configured to use 2-step verification you must use an AppPaswword. In this case you cannot enable less secure apps.
  • if your google account is not configured to use 2-step verification, you must enable less secure apps, and log to your account from a browser in the machine where youtrack is installed (as pointed out in the comment). In this case you cannot create App Passwords.

Additional notes:

  • as you can see, the youtrack configuration is the same in both cases, save for the password, which is the AppPassword if you use the first option, or the account password, if you use the second one.
  • in the from email, the email account is ignored, but you can specify a friendly name if you use this syntax: "Friendly Name <[email protected]>" When someone receives a notification he'll see From: Friendly Name. The account, whichever you specify, will be replaced by the google account you're configuring.