Friday, November 13, 2015

[FreeNAS Alert]: Setting up FreeNAS to use gmail for email service

Setting up FreeNAS to use gmail for email service


If you choose to use FreeNAS S.M.A.R.T service then you will want to make sure you have an email service to use for sending emails. I choose to use gmail for this service since it’s rocks. This explains what settings to use.
  1. Using the FreeNAS WebGUI go to System -> Advanced and select the Email tab.
  2. Fill in the following fields:
    1. From Email: youremail@gmail.com
    2. Outgoing Mail Server: smtp.gmail.com
    3. Port: 465
    4. Security: SSL
    5. Authentication: Check Enable SMTP Authentication
    6. Username: youremail@gmail.com
    7. Password: xxxxxxxx
    8. Authentication Method: Login
Once this is done send yourself a test email by clicking the button and you should have no issue getting an email….. however….
I did have an issue where it couldn’t find the server smtp.gmail.com which appeared to be a dns issue. To fix this I appended google’s dns server to my/etc/resolv.conf (which unfortunately this files gets overridden after every reboot, but it didn’t matter since this command kicked it in the butt to get it working).
If you go into System -> Advanced menu, there is option to set commands to be executed after every reboot. I just added new postinit command:
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Also make sure that root has your mail id where you want to receive mail. pls check below for details
To configure email on FreeNAS 9.3, do the following steps.
Login to FreeNAS web interface and go to System | Email.
email setup on freenas 9.3 step1
Enter your email address in From email section. For example: fitri@gmail.com. Next, specify the Outgoing mail server. If you are using gmail, it would be smtp.gmail.com. Type 465 on Port to connect to, TLS/SSL set to SSL. Check the Use SMTP Authentication option. Enter your gmail username and password. Save it.
Because the email will be sent to root account, we need to setup email for root account. Go to Users and click View Users. Click root username and press Change email. You can
setup email on freenas
Type the root email and press OK
change email freenas
Now any important log will be sent to your root email address.

2 comments:

Anonymous said...

Thank you so many years later for this!
Simple and exactly what I needed.

Anonymous said...

Thanks this worked for me. Though it was rejecting my username and password.

I needed to enable less secure apps

https://support.google.com/accounts/answer/6010255?hl=en#zippy=%2Cif-less-secure-app-access-is-on-for-your-account%2Cif-less-secure-app-access-is-off-for-your-account