Solved: Proper fix for alert emails not being sent with iCloud?

Daisuke

Contributor
Joined
Jun 23, 2011
Messages
1,041
In current Angelfish release, alert emails are not being received when using iCloud servers. Yet, the email service works properly with any Kubernetes applications running on it. So is not the configuration, but the actual Scale email service. I see this ticket was open but closed without a real resolution. Is it possible to have it fixed in Bluefin?

Screen Shot 2022-10-31 at 9.47.00 PM.png

 
Last edited:

ronny.a

Cadet
Joined
Jul 26, 2022
Messages
8
I am using an icloud account and email alerts works for me. I have generated an app specific password on icloud.com which is then the password I've configured SCALE to use. There are a couple och places where email settings have to be configured, one is that the root user must have an email adress configured. What smtp server are you using? I am using smtp.mail.me.com
 

Daisuke

Contributor
Joined
Jun 23, 2011
Messages
1,041
@ronny.a As I mentioned into OP, the SMTP settings are correct. I receive emails from @truecharts apps. Please look at the screenshot above and set the alert emails, then try to send a test email. You will never receive it. This issue has been confirmed by several users. Unless there is another setting we all missed and is not documented.

I had critical alerts which I never got notified through email.

1667508707682.png


1667509060556.png
 
Last edited:

ronny.a

Cadet
Joined
Jul 26, 2022
Messages
8
I have the same settings as you show in your screenshot and I just clicked the "Send Test Email" and it sure worked, got "This is a test message from TrueNAS SCALE." sent to my icloud account. Have you set the email address for the root user?
 

Daisuke

Contributor
Joined
Jun 23, 2011
Messages
1,041
@ronny.a thank you for testing. I had the email set as root@uranus.lan, for the love of Linux I changed it to username@icloud.com and tried again to send a test email, I did not received anything. I use the same SMTP iCloud settings on several Linux machines and email works properly. Also, how do you explain emails from TrueCharts Kubernetes apps running inside Scale Kubernetes cluster are received properly, without root email setup. Based on logic, the alert emails use their own defined settings, non-related to root email.

Example from a non-Scale Debian Bullseye machine using the iCloud settings:
Code:
# echo 'This is a test.' | mail -s 'Hello World' some@email.com

Result:

Screen Shot 2022-11-03 at 5.08.34 PM.png

Running the same command on Scale does nothing, of course the test email fails to be sent. I'm on same network the non-Scale server is:
Code:
# cat /etc/aliases
# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: username@icloud.com

# newaliases
# echo 'This is a test.' | mail -s 'Hello TrueNAS' some@email.com
 
Last edited:

ronny.a

Cadet
Joined
Jul 26, 2022
Messages
8
I would recommend that you setup an "app specific password" on https://appleid.apple.com/ that you then only use for the truenas email settings. My guess is that the emails aren't being sent because the <username>@icloud.com and the icloud password aren't correct. Your root account should have <username>@icloud.com and then you also need the (icloud) password configured, hence generating the "app specific password" which you can revoke easily when/if things go bad. I haven't tested it but I doubt that you can use smtp.mail.me.com anonymously.
 

ronny.a

Cadet
Joined
Jul 26, 2022
Messages
8
First, it is difficult to answer your posts when you edit them after I have posted my answers. Makes me look bad, like I didn't read your reply properly.

Also, how do you explain emails from TrueCharts Kubernetes apps running inside Scale Kubernetes cluster are received properly, without root email setup. Based on logic, the alert emails use their own defined settings, non-related to root email.
I am going to be the annoying one now and say "Read the docs". It says that the first thing you need to do is to configure the root email. https://www.truenas.com/docs/scale/scaletutorials/toptoolbar/settingupsystememail/ (edit: clean up URL)

This is probably what is needed for the alerts (and also then perhaps the test email) to work. I am not using any Kubernetes apps yet so I can't answer for that. But all that is really needed to send any email through authenticated SMTP is the username and the password.

I have the exact same <username>@icloud.com configured in (at least) three different places: The root user under Credentials -> local users and also in the Alerts -> Email page, both in the "From Email" field and under SMTP username.
 

Daisuke

Contributor
Joined
Jun 23, 2011
Messages
1,041
I would recommend that you setup an "app specific password"
You cannot send iCloud emails without an application password with software other than Apple products, is a two-factor security feature.

As a side note for your knowledge, the Username must be your true AppleID email account or the linked iCloud alias (which you cannot modify or delete). From Email can be any @icloud.com alias you can create, modify or delete, but must be part of your list of linked emails to main AppleID. For example, you can use truenas@icloud.com, which is an account alias you created into username@icloud.com account.

Say you create your AppleID with username@gmail.com, Apple will let you create an additional username@icloud.com alias which will die with your account and cannot be changed after. You can change the username@gmail.com email to any other email, but not the username@icloud.com alias. You can use either of these 2 accounts as Username. I personally use the @icloud.com one because it never changes.

Using into From Email an email not being any of your linked iCloud aliases will result in an invalid From Email error.

I posted these details because many people are not aware of.

I am going to be the annoying one now and say "Read the docs".
Is not annoying at all, thank you for trying to help. I did all this already and emails are not sent, as I demonstrated into previous post.

I have the exact same <username>@icloud.com configured in (at least) three different places
Same for me, I followed your guidelines. What is your root shell, /usr/bin/zsh?

Try this for me, run this command from Scale console or from a SSH terminal, as root (change the some@email.com email with some of your personal emails, not @icloud.com:
Code:
echo 'This is a test.' | mail -s 'Hello TrueNAS' some@email.com

You should receive the email, let me know if you do. I don't and I should, that is what I'm trying to fix.
 
Last edited:

Daisuke

Contributor
Joined
Jun 23, 2011
Messages
1,041
I found the problem, unbelievable. I had an old public domain Hostname: uranus Domain: domain.com configured into Scale Global Configuration. As soon as I've set the correct hostname, emails started being sent. Which is obvious, since the public domain would not resolve anymore.

1667521825374.png


That, combined with the wrong root@uranus.lan email. Thank you @ronny.a.
Code:
# echo 'This is a test.' | mail -s 'Hello TrueNAS' some@email.com

Result:

Screen Shot 2022-11-03 at 8.29.21 PM.png
 
Last edited:
Top