How to make mail command to send email to root after installing msmtp?
0
votes
1
answer
728
views
Install a simple SMTP client:
sudo apt install msmtp msmtp-mda
Set in msmtprc
::
cat .msmtprc
account default
host smtp.qq.com
from x1@qq.com
auth on
tls on
tls_certcheck off
user x1@qq.com
password xxxx
logfile ~/.msmtp.log
I can send email with qq account.
echo "Testing msmtp " | mail -s "hi root" -r x1@qq.com -- aa@yahoo.com
The email can be found in yahoo email.
I find a new issue that user can't send email to root in system!
echo "cron task work done " | mail -s "hi root" root
mail: cannot send message: Process exited with a non-zero status
Check the log:
Aug 24 20:47:31 host=smtp.qq.com tls=on auth=on user=x1@qq.com from=debian@debian.debian recipients=root@debian.debian smtpstatus=501 smtpmsg='501 Mail from address must be same as authorization user.' errormsg='envelope from address debian@debian.debian not accepted by the server' exitcode=EX_DATAERR
echo "cron task work done " | mail -s "hi root" -r debian@debian.debian root
The log info:
Aug 29 06:56:39 host=smtp.qq.com tls=on auth=on user=x1@qq.com from=debian@debian.debian recipients=root@debian.debian smtpstatus=501 smtpmsg='501 Mail from address must be same as authorization user.' errormsg='envelope from address debian@debian.debian not accepted by the server' exitcode=EX_DATAERR
Everytime mail command was called ,it relay to external host smtp.qq.com enven if i specify return host as debian@debian.debian,how can make mail command send email between user and root in the system?
I find that postfix or exim4 will be removed when to install msmtp-mda,the fact maybe realted with my issue.
Asked by showkey
(499 rep)
Aug 24, 2023, 12:52 PM
Last activity: Aug 30, 2023, 03:49 PM
Last activity: Aug 30, 2023, 03:49 PM