Are you having trouble getting TrueNAS to email you in Gmail?

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Update for TrueNAS (12.x): There is now an option in System>Email settings to enable GMail OAuth. This allows account authorization via a API. Simply, this asks you to login to your Google account and to allow TrueNAS access your account and to remove the need for a special app password (this method is still listed below if you wish to use it instead). The advantage of GMail OAuth is that there is a simple account login and then authorization via your phone assuming you 2-Step Verification set in your Google Account Settings (Steps 1-5 of the App Password instructions listed below).

How GMail OAuth authorization works
At a high level, all apps follow the same basic authorization pattern:
  1. When the OAuth app launches, request that the user grant access to data in their Google account.
  2. If the user consents, TrueNAS requests and receives credentials to access the Gmail API.
  3. Refresh the credentials (if necessary).

Instructions
Are you having troubles getting TrueNAS to email you when setting up the email address parameters in Settings>Email? It could be because you have Google's 2-step verification enabled. You need to set an application-specific password for TrueNAS in your Google's security settings.

I'll first describe the steps to set an application-specific password and then I'll go over the settings for making sure you have the right parameters set in TrueNAS.

Option 1: Assign an App Password in Gmail
  1. Go to your Gmail or Google page.
  2. Click your picture in the top-right
  3. Click Manage your Google Account
  4. Click Security on the left menu
  5. You will now see the section "2-Step Verification"
  6. Then click "App Passwords" at the very bottom of the page
  7. In the App Name box enter the name of the app for which you wish to create a password
  8. Click Create
  9. Copy the password that appears in the Yellow box, you will need this for your password in the TrueNAS Email settings - This is the only time you will ever be able to see this password so copy it. If you forget it, you will need to revoke the app password and start over.
  10. Click Done and exit
Gmail parameters for setting up an email address in TrueNAS to receive system notifications
  • From email: the from email address to be used when sending email notifications
  • Outgoing mail server: smtp.gmail.com
  • Port to connect to: 587 (for TLS)
  • TSL/SSL: TLS
  • Use SMTP Authentication: (checked)
  • Username: youremail@gmail.com
  • Password: (the password you copied from the Gmail App Password in step 10 above, not your normal Gmail password if you have Google's 2-step verification enabled. If you don't have Google's 2-step verification enabled then yes - enter your normal Gmail password.)
Option 2: Use GMail OAuth
  1. Click the GMail OAuth radio button
  2. You will get a pop-up window asking if you want to allow TrueNAS access, accept this.
  3. You will now need to login to your Google Account
  4. Assuming you setup 2-Step Verification in your Google Account Security Settings, you will now be prompted on your phone (or email) to allow TrueNAS to access your Google Account. Allow this.
  5. That's it! Send a test email.
Changelog:
Jan 12, 2021: Added info about the new GMail OAuth option offered in TrueNAS 12.x
Jan 09, 2019: Updated to the latest Google GUI layout
Jan 08, 2017: Changed the security to TLS and port 587.

Additional search tags
Hotmail, Yahoo mail, 2-factor, factor, two-factor, test email, 2-step, two-step
 
Last edited:

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,175
I'd like to add that a similar procedure solves the same problem with Outlook.com (as well as any other e-mail provider that uses two-factor authentication).
 

Paranoiak

Dabbler
Joined
Jun 3, 2014
Messages
46
I didn't know the App Password feature in Gmail, so thank you very much for this thread ! :smile:
 

NealNye

Cadet
Joined
Mar 12, 2014
Messages
4
Very nice, thanks. I was confused at first because I didn't have 2-factor enabled so the settings in Apps passwords wasn't there. But after enabling that, I got a test e-mail from the NAS. Working e-mail and tighter Google security settings - double win!
 

sfl

Dabbler
Joined
Apr 14, 2012
Messages
11
Just wondering if anyone has noticed that without application passwords (which seems to only be enabled with 2 factor authentication), the only way to have some clients work (FreeNAS included it seems) with a gmail account is to "allow less secure apps" to be enabled. While I get that there's likely been some improvements to authentication independent of 2 factor auth. it's not quite clear to me how these are any less secure considering they support SSL/TLS. Would anyone be able to clarify how FreeNAS is considered less secure?
 

Ruff.Hi

Patron
Joined
Apr 21, 2015
Messages
271
I've just created a NAS specific gmail account. FreeNAS can run that and email my normal account. I am pretty sure that this set up will let me delete the dull, boring, everyday NAS emails and also keep a record of all emails in the 'sent' folder of the NAS gmail account. I'll update this post once I have it up and running.

Edit: My NAS root user email is set to my NAS specific gmail account and I have set up the email as per post #1. Initially, it wasn't working as google had set the 'allow less secure applications' to FALSE. However, setting that to TRUE released FreeNAS to access this account. Email working!

Google also emailed me to warn me that someone was hacking my account. They included ...

If this was you
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards.


So ... with my specific NAS gmail account sending emails to itself, I get a complete repository of NAS emails plus with the gmail forwarding in action, my normal account gets the NAS emails and I can happily delete them if they are boring.
 
Last edited:

Easygoer

Explorer
Joined
Mar 11, 2014
Messages
53
Are you having troubles getting FreeNAS to email you when setting up the email address parameters in Settings>Email? It could be because you have Google's 2-step verification enabled. You need to set an application-specific password for FreeNAS in your Google's security settings.

I'll first describe the steps to set an application-specific password and then I'll go over the settings for making sure you have the right parameters set in FreeNAS.

Assign an App Password in Gmail
  1. Go to your Gmail or Google page.
  2. Click your picture in the top-right
  3. Click Account
  4. Click Security at the top
  5. In the Password section - Click Settings next to App Passwords
  6. On this new page - Click the drop-down box that says Select app - Click Mail
  7. Just to the right is a drop-down box that says Select Device - Click Other (custom name)
  8. Enter a name for your FreeNAS system
  9. Click Generate
  10. Copy the password that appears in the Yellow box, you will need this for your password in the FreeNAS Email settings - This is the only time you will ever be able to see this password so copy it down. If you forget it, you will need to revoke the app password and start over.
  11. Click Done and exit
Gmail parameters for setting up an email address in FreeNAS to receive system notifications
  • From email: the from email address to be used when sending email notifications
  • Outgoing mail server: smtp.gmail.com
  • Port to connect to: 465 (for SSL)
  • TSL/SSL: SSL
  • Use SMTP Authentication: (checked)
  • Username: youremail@gmail.com
  • Password: (the password you copied from the Gmail App Password in step 10 above, not your normal Gmail password if you have Google's 2-step verification enabled. If you don't have Google's 2-step verification enabled then yes - enter your normal Gmail password.)

Additional search tags
Hotmail, Yahoo mail, 2-factor, factor, two-factor, test email

I had this problem (email not being sent automatically through Freenas) crop up suddenly after I upgraded to 9.3.1 20160118.

I would like to say that the above procedure worked for me. Setting up the App Password in Google is the key in case one has enabled 2SA. In any case follow the steps to the letter. It works!!!

Thanks to diedrichg. Appreciate the detail steps for a noob like me.
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Changelog:
Feb 11, 2016:
Updated the app password section to reflect web page layout. I also added the notation to allow less secure apps. Thank you @Ruff.Hi !
 

Terie Mumby

Cadet
Joined
Feb 17, 2016
Messages
2
Diedrich,
Nice tutorial. Thanks for doing this for us newbs.
I'm obviously still getting something wrong cuz it ain't working for me yet. First off. I think I'm not putting the correct "From email:" in. What do I put here? Where do I find this?
Secondly, The generated password comes in four, four-letter chunks. Am I supposed to add spaces between the four-letter chunks or is it all run together?
Thanks!
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Diedrich,
Nice tutorial. Thanks for doing this for us newbs.
I'm obviously still getting something wrong cuz it ain't working for me yet. First off. I think I'm not putting the correct "From email:" in. What do I put here? Where do I find this?
Secondly, The generated password comes in four, four-letter chunks. Am I supposed to add spaces between the four-letter chunks or is it all run together?
Thanks!

There is a note next to that randomly generated password that says that it doesn't matter if you leave the spaces in or not, it'll compensate.

You should use your email... Unless you have set up a gmail account specifically for your server - that way you know who it's coming from and... well, it's just for anyone who likes to be anal.
 

Easygoer

Explorer
Joined
Mar 11, 2014
Messages
53
Diedrich,
Nice tutorial. Thanks for doing this for us newbs.
I'm obviously still getting something wrong cuz it ain't working for me yet. First off. I think I'm not putting the correct "From email:" in. What do I put here? Where do I find this?
Secondly, The generated password comes in four, four-letter chunks. Am I supposed to add spaces between the four-letter chunks or is it all run together?
Thanks!
Hi....I had to redo the email problem just a couple of days ago. Here's what I did....I followed Diedrich's method to the letter. He has updated it recently as I recall.

From email: put your@gmail.com (I use my gmail address) email address.
I copied and pasted the four-letter chunks "as is", no spaces required. Paste that into your password space, and hit save.
Then try sending an email. If all is well you will get a "email sent successfully" message in "red".
Check your email to make sure it has arrived.
Hope it works for you. Cheers.
 

Terie Mumby

Cadet
Joined
Feb 17, 2016
Messages
2
I got it going! Not my Gmail account though. I let my frustration get the better of me and used a different email account. Even that was frustrating but the point is I have the gui sending email.
I must say, this was my first post and you guys were super helpful and awesomely quick to respond with assistance.
Very impressed. Thanks so much for your patience and understanding.
I've been trying to get it going for over a month and thought it was because I have two routers in my home and the NAS is sitting behind the second one. However, this isn't the place to discuss this.
Thanks again.
Terie

PS... I think I probably should have entered this response as a reply to the post above and therefore its in the wrong spot. Sorry about that. I'm not sure if I can move it but I surely will remember next time.
 
Last edited:

trigate

Cadet
Joined
May 5, 2016
Messages
8
Just so that you guys know:

I guess if you use a strong password (my gmail has 20 characters) you don't need to do anything. It worked out of the box. With a 10 digit pw it didn't work instantly.
 

yourmate

Contributor
Joined
Apr 4, 2016
Messages
105
I've just created a NAS specific gmail account.

You are quite right! I always do the same with my devices and I just could not understand the fuss why people want to set up their own email and password on the device...

It takes 5 mins to set up a new gmail account and you just assign a label to those mails in your own account and you will be able to do all the fancy stuff ;)
 

lukyjay

Contributor
Joined
May 13, 2016
Messages
134
Thank you, this solved my problem.

I am wondering why you suggest the use of SSL? Google search is telling me TLS is more secure, and it's working fine for me.
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Thank you, this solved my problem.

I am wondering why you suggest the use of SSL? Google search is telling me TLS is more secure, and it's working fine for me.
Because that was 2.5 years ago and SSL was SO 2014. But now the cool kids are using TLS - because it's 2017, so I've updated the OP to TLS and port 587. I did a test and it works fine on my end.
 

Ryan Allen

Explorer
Joined
Oct 11, 2016
Messages
93
I'm having some troubles getting FreeNAS Corral to like my email settings. I have another box that's running 9.10 without any issues. I tried to do the same set up on Corral but still no good. Any advice?
 

Seb000

Cadet
Joined
Mar 24, 2017
Messages
1
Hi,
I use freenas 9.10.2
I set everything as described in this post...
The test email is sent in freenas, no error message, but nothing received in my gmail.
What is the problem ?
 

Ryan Allen

Explorer
Joined
Oct 11, 2016
Messages
93
Thanks guys! I was able to get it going. I had to manually enter in my Default Gateway. My DHCP did not supply it automatically when it was "Checked" to do so.
 
Top