Q: msmtp with iCloud account doesn't work I'm very new to Linux (Raspbian at Raspberry Pi 4 Model B) and I just try to send an e-mail via command line. Right now, this is working with msmtp and a gmx.de account following this guide.
apt-get update && apt-get upgrade -V

apt-get install msmtp msmtp-mta mailutils


/etc/msmtprc and ~/.msmtprc contains

# Set default values for all following accounts.
defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        ~/.msmtp.log

# Mail account
account my_name@gmx.de
host mail.gmx.net
from my_name@gmx.de
auth on
user my_name@gmx.de
password PASSWORD

account default : my_name@gmx.de

aliases /etc/aliases


/etc/aliases contains

root: my_name@gmx.de
default: my_name@gmx.de


/etc/mail.rc contains

set sendmail="/usr/bin/msmtp -t"

1. Test
echo "Content of the e-mail" | mail -s "Subject" my_name@gmx.de

This works pretty well! But if I change this to my iCloud account the authentication fails (password is correct ;)).
# Set default values for all following accounts.
defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Mail account
account my_name@icloud.com
host smtp.mail.me.com
from my_name@icloud.com
auth on
user my_name@icloud.com
password PASSWORD

account default : my_name@icloud.com

aliases /etc/aliases

2. Test
pi@raspberrypi:~ $ echo "Content of the e-mail" | mail -s "Subject" my_name@icloud.com
msmtp: authentication failed (method PLAIN)
msmtp: server message: 535 5.7.8 Error: authentication failed
msmtp: could not send mail (account default from /home/pi/.msmtprc)
mail: Sending data to /usr/bin/msmtp -t failed: Process exited with a non-zero status
mail: cannot send message: Process exited with a non-zero status

Is there anything I can do now? Any help is appreciated!
