<div class="bbWrapper"><b><span style="color: rgb(41, 105, 176)"><span style="font-size: 18px">Update for TrueNAS (12.x):</span></span></b> 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 <b>assuming you 2-Step Verification set in your Google Account Settings</b> (Steps 1-5 of the App Password instructions listed below).<br />
<br />
<b>How GMail OAuth authorization works</b><br />
<div class="bbCodeSpoiler">
<button type="button" class="bbCodeSpoiler-button button" data-xf-click="toggle" data-xf-init="tooltip" title="Click to reveal or hide content"><span class="button-text">
<span>Show </span>
</span></button>
<div class="bbCodeSpoiler-content">
<div class="bbCodeBlock bbCodeBlock--spoiler">
<div class="bbCodeBlock-content">At a high level, all apps follow the same basic authorization pattern:<br />
<ol>
<li data-xf-list-type="ol">When the OAuth app launches, request that the user grant access to data in their Google account.</li>
<li data-xf-list-type="ol">If the user consents, TrueNAS requests and receives credentials to access the Gmail API.</li>
<li data-xf-list-type="ol">Refresh the credentials (if necessary).</li>
</ol></div>
</div>
</div>
</div><br />
<b><span style="color: rgb(41, 105, 176)"><span style="font-size: 22px">Instructions</span></span></b><br />
Are you having troubles getting TrueNAS to email you when setting up the email address parameters in Settings>Email? <span style="color: #b30000">It could be because you have Google's 2-step verification enabled.</span> You need to set an application-specific password for TrueNAS in your Google's security settings.<br />
<br />
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.<br />
<br />
<b><span style="font-size: 18px"><span style="color: rgb(41, 105, 176)">Option 1: </span>Assign an App Password in Gmail</span></b><br />
<div class="bbCodeSpoiler">
<button type="button" class="bbCodeSpoiler-button button" data-xf-click="toggle" data-xf-init="tooltip" title="Click to reveal or hide content"><span class="button-text">
<span>Show </span>
</span></button>
<div class="bbCodeSpoiler-content">
<div class="bbCodeBlock bbCodeBlock--spoiler">
<div class="bbCodeBlock-content"><ol>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Go to your Gmail or Google page.</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click your picture in the top-right</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Manage your Google Account</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Security on the left menu</span></span></li>
<li data-xf-list-type="ol">You will now see the section "2-Step Verification"</li>
<li data-xf-list-type="ol">T<span style="font-size: 18px"><span style="font-size: 15px">hen click "App Passwords" at the very bottom of the page</span></span></li>
<li data-xf-list-type="ol">In the<span style="font-size: 18px"><span style="font-size: 15px"> App Name box enter the name of the app for which you wish to create a password</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Create</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Copy the password that appears in the Yellow box, you will need this for your password in the TrueNAS Email settings - <span style="color: rgb(184, 49, 47)"><b>This is the only time you will ever be able to see this password so copy it.</b></span> If you forget it, you will need to revoke the app password and start over.</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Done and exit</span></span></li>
</ol><span style="font-size: 18px"><b>Gmail parameters for setting up an email address in TrueNAS to receive system notifications</b></span><br />
<ul>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>From email:</b> the <b>from</b> email address to be used when sending email notifications</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Outgoing mail server:</b> smtp.gmail.com</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Port to connect to:</b> 587 (for TLS)</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>TSL/SSL:</b> TLS</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Use SMTP Authentication: </b>(checked)</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Username:</b> <a href="mailto:youremail@gmail.com">youremail@gmail.com</a></span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Password:</b> (the password you copied from the Gmail App Password in step 10 above, <b>not</b> your normal Gmail password if you have Google's 2-step verification enabled. If you <i>don't </i>have Google's 2-step verification enabled then yes - enter your normal Gmail password.)</span></span></li>
</ul></div>
</div>
</div>
</div><b><span style="font-size: 18px"><span style="color: rgb(41, 105, 176)">Option 2:</span> Use GMail OAuth</span></b><br />
<div class="bbCodeSpoiler">
<button type="button" class="bbCodeSpoiler-button button" data-xf-click="toggle" data-xf-init="tooltip" title="Click to reveal or hide content"><span class="button-text">
<span>Show </span>
</span></button>
<div class="bbCodeSpoiler-content">
<div class="bbCodeBlock bbCodeBlock--spoiler">
<div class="bbCodeBlock-content"><ol>
<li data-xf-list-type="ol">Click the GMail OAuth radio button</li>
<li data-xf-list-type="ol">You will get a pop-up window asking if you want to allow TrueNAS access, accept this.</li>
<li data-xf-list-type="ol">You will now need to login to your Google Account</li>
<li data-xf-list-type="ol">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.</li>
<li data-xf-list-type="ol">That's it! Send a test email.</li>
</ol></div>
</div>
</div>
</div><b>Changelog:</b><br />
<div class="bbCodeSpoiler">
<button type="button" class="bbCodeSpoiler-button button" data-xf-click="toggle" data-xf-init="tooltip" title="Click to reveal or hide content"><span class="button-text">
<span>Show </span>
</span></button>
<div class="bbCodeSpoiler-content">
<div class="bbCodeBlock bbCodeBlock--spoiler">
<div class="bbCodeBlock-content"><b>Jan 12, 2021: </b>Added info about the new GMail OAuth option offered in TrueNAS 12.x<br />
<b>Jan 09, 2019: </b>Updated to the latest Google GUI layout<br />
<b>Jan 08, 2017: </b>Changed the security to TLS and port 587.</div>
</div>
</div>
</div><br />
Additional search tags<br />
Hotmail, Yahoo mail, 2-factor, factor, two-factor, test email, 2-step, two-step</div>
<div class="bbWrapper">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).</div>
<div class="bbWrapper">I didn't know the App Password feature in Gmail, so thank you very much for this thread ! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":smile:" title="Smile :smile:" loading="lazy" data-shortname=":smile:" /></div>
<div class="bbWrapper">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!</div>
<div class="bbWrapper">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?</div>
<div class="bbWrapper">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.<br />
<br />
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!<br />
<br />
Google also emailed me to warn me that someone was hacking my account. They included ...<br />
<br />
<i><b>If this was you</b><br />
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at <a href="https://www.google.com/settings/security/lesssecureapps" target="_blank" class="link link--external" rel="nofollow ugc noopener">https://www.google.com/settings/security/lesssecureapps</a> so that your account is no longer protected by modern security standards. </i><br />
<br />
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.</div>
<div class="bbWrapper"><blockquote data-attributes="member: 26981" data-quote="diedrichg" data-source="post: 134290"
class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch">
<div class="bbCodeBlock-title">
<a href="/community/goto/post?id=134290"
class="bbCodeBlock-sourceJump"
rel="nofollow"
data-xf-click="attribution"
data-content-selector="#post-134290">diedrichg said:</a>
</div>
<div class="bbCodeBlock-content">
<div class="bbCodeBlock-expandContent js-expandContent ">
Are you having troubles getting FreeNAS to email you when setting up the email address parameters in Settings>Email? <span style="color: #b30000">It could be because you have Google's 2-step verification enabled.</span> You need to set an application-specific password for FreeNAS in your Google's security settings.<br />
<br />
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.<br />
<br />
<span style="font-size: 18px"><b>Assign an App Password in Gmail</b></span><br />
<ol>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Go to your Gmail or Google page.</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click your picture in the top-right</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Account</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Security at the top</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">In the Password section - Click Settings next to App Passwords</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">On this new page - Click the drop-down box that says Select app - Click Mail</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Just to the right is a drop-down box that says Select Device - Click Other (custom name)</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Enter a name for your FreeNAS system</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Generate</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">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.</span></span></li>
<li data-xf-list-type="ol"><span style="font-size: 18px"><span style="font-size: 15px">Click Done and exit</span></span></li>
</ol><span style="font-size: 18px"><b>Gmail parameters for setting up an email address in FreeNAS to receive system notifications</b></span><br />
<ul>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>From email:</b> the <b>from</b> email address to be used when sending email notifications</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Outgoing mail server:</b> smtp.gmail.com</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Port to connect to:</b> 465 (for SSL)</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>TSL/SSL:</b> SSL</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Use SMTP Authentication: </b>(checked)</span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Username:</b> <a href="mailto:youremail@gmail.com">youremail@gmail.com</a></span></span></li>
<li data-xf-list-type="ul"><span style="font-size: 18px"><span style="font-size: 15px"><b>Password:</b> (the password you copied from the Gmail App Password in step 10 above, <b>not</b> your normal Gmail password if you have Google's 2-step verification enabled. If you <i>don't </i>have Google's 2-step verification enabled then yes - enter your normal Gmail password.)</span></span></li>
</ul><br />
Additional search tags<br />
Hotmail, Yahoo mail, 2-factor, factor, two-factor, test email
</div>
<div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div>
</div>
</blockquote><br />
I had this problem (email not being sent automatically through Freenas) crop up suddenly after I upgraded to 9.3.1 20160118.<br />
<br />
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!!!<br />
<br />
Thanks to diedrichg. Appreciate the detail steps for a noob like me.</div>
<div class="bbWrapper">Thank you <a href="https://forums.freenas.org/index.php?members/diedrichg.26981/" target="_blank" class="link link--external" rel="nofollow ugc noopener">diedrichg <span style="color: #000000">for the detailed info. I was having trouble getting FreeNAS to email, but not any more :D</span></a><br />
Also thanks to <a href="https://forums.freenas.org/index.php?members/ruff-hi.49230/" target="_blank" class="link link--external" rel="nofollow ugc noopener">Ruff.Hi</a> for the tip on <i>"<b>allow less secure applications</b>"</i>.</div>
<div class="bbWrapper"><b>Changelog:<br />
Feb 11, 2016: </b>Updated the app password section to reflect web page layout. I also added the notation to allow less secure apps. Thank you <a href="https://www.truenas.com/community/members/49230/" class="username" data-xf-init="member-tooltip" data-user-id="49230" data-username="@Ruff.Hi">@Ruff.Hi</a> !</div>
<div class="bbWrapper">Diedrich, <br />
Nice tutorial. Thanks for doing this for us newbs.<br />
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?<br />
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?<br />
Thanks!</div>
<div class="bbWrapper"><blockquote data-attributes="member: 57182" data-quote="Terie Mumby" data-source="post: 281515"
class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch">
<div class="bbCodeBlock-title">
<a href="/community/goto/post?id=281515"
class="bbCodeBlock-sourceJump"
rel="nofollow"
data-xf-click="attribution"
data-content-selector="#post-281515">Terie Mumby said:</a>
</div>
<div class="bbCodeBlock-content">
<div class="bbCodeBlock-expandContent js-expandContent ">
Diedrich, <br />
Nice tutorial. Thanks for doing this for us newbs.<br />
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?<br />
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?<br />
Thanks!
</div>
<div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div>
</div>
</blockquote><br />
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. <br />
<br />
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.</div>
<div class="bbWrapper"><blockquote data-attributes="member: 57182" data-quote="Terie Mumby" data-source="post: 281515"
class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch">
<div class="bbCodeBlock-title">
<a href="/community/goto/post?id=281515"
class="bbCodeBlock-sourceJump"
rel="nofollow"
data-xf-click="attribution"
data-content-selector="#post-281515">Terie Mumby said:</a>
</div>
<div class="bbCodeBlock-content">
<div class="bbCodeBlock-expandContent js-expandContent ">
Diedrich,<br />
Nice tutorial. Thanks for doing this for us newbs.<br />
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?<br />
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?<br />
Thanks!
</div>
<div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div>
</div>
</blockquote>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.<br />
<br />
From email: put <a href="mailto:your@gmail.com">your@gmail.com</a> (I use my gmail address) email address.<br />
I copied and pasted the four-letter chunks "as is", no spaces required. Paste that into your password space, and hit save. <br />
Then try sending an email. If all is well you will get a "email sent successfully" message in "red". <br />
Check your email to make sure it has arrived.<br />
Hope it works for you. Cheers.</div>
<div class="bbWrapper">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. <br />
I must say, this was my first post and you guys were super helpful and awesomely quick to respond with assistance.<br />
Very impressed. Thanks so much for your patience and understanding. <br />
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. <br />
Thanks again. <br />
Terie <br />
<br />
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.</div>
<div class="bbWrapper">Just so that you guys know:<br />
<br />
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.</div>
<div class="bbWrapper"><blockquote data-attributes="member: 49230" data-quote="Ruff.Hi" data-source="post: 196581"
class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch">
<div class="bbCodeBlock-title">
<a href="/community/goto/post?id=196581"
class="bbCodeBlock-sourceJump"
rel="nofollow"
data-xf-click="attribution"
data-content-selector="#post-196581">Ruff.Hi said:</a>
</div>
<div class="bbCodeBlock-content">
<div class="bbCodeBlock-expandContent js-expandContent ">
I've just created a NAS specific gmail account.
</div>
<div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div>
</div>
</blockquote><br />
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...<br />
<br />
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 ;)</div>
<div class="bbWrapper">Thank you, this solved my problem.<br />
<br />
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.</div>
<div class="bbWrapper"><blockquote data-attributes="member: 59801" data-quote="lukyjay" data-source="post: 338523"
class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch">
<div class="bbCodeBlock-title">
<a href="/community/goto/post?id=338523"
class="bbCodeBlock-sourceJump"
rel="nofollow"
data-xf-click="attribution"
data-content-selector="#post-338523">lukyjay said:</a>
</div>
<div class="bbCodeBlock-content">
<div class="bbCodeBlock-expandContent js-expandContent ">
Thank you, this solved my problem.<br />
<br />
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.
</div>
<div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div>
</div>
</blockquote>Because that was 2.5 years ago and SSL was <b>SO</b> 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.</div>
<div class="bbWrapper">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?</div>
<div class="bbWrapper">Hi,<br />
I use freenas 9.10.2<br />
I set everything as described in this post...<br />
The test email is sent in freenas, no error message, but nothing received in my gmail.<br />
What is the problem ?</div>
<div class="bbWrapper">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.</div>