In the article How to install and configure mail server on Ubuntu 16.04, I tried to configure ubuntu as an email server. In use, I found that this sending method is very unstable, I guess it should be the sending server [domain name resolution] (https://cloud.tencent.com/product/cns?from=10680) problem.
The possible reason is that after the mail is sent to the target mail server, the target server judges that the sender's mail address does not match the actual source mail server ip address, so it is discarded as spam. Today I tried sendemail on ubuntu to send mail in the terminal, which is very convenient and easy to use.
2017- 12- 26 update: When viewing the system log and configuring ubuntu as the mail sending server to send mail to 126 mailboxes, the following error message was found:
host 126mx03.mxmail.netease.com[220.181.15.196] said:554 DT:SPM 126 mx16,xMmowABnAeR_ujtawL6qEg--.27616S2 1513863808,please see
http://mail.163.com/help/help_spam_16.htm?
ip=222.175.171.52&hostid=mx16&time
=1513863808
After checking [126 common problems of mailbox bounce mail] (https://link.jianshu.com/?t=http%3A%2F%2Fhelp.163.com%2F09%2F1224%2F17%2F5RAJ4LMH00753VB8.html), there are several reasons for the error code
554
:
- 554 The content of the email sent by DT:SPM contains unauthorized information or is recognized as spam by the system. Please check if any users send viruses or spam;
- 554 DT: The sender of the SUM envelope does not match the sender of the letter;
- 554 IP is rejected, smtp auth error limit exceed The IP verification failed too many times and was temporarily prohibited from connecting. Please check the verification information settings;
- 554 HL: IHU’s sending IP was temporarily suspended due to spam or abnormal connection behavior. Please check the history of the sending IP and whether the sending procedure is abnormal;
- 554 HL:IPB The IP is not in the list of sending addresses allowed by NetEase;
- 554 MI: The STC sender’s cumulative number of emails exceeds the limit in the day, and no more letters from the sender will be accepted on that day. Please reduce the sending frequency;
- 554 MI:SPB This user is not in the list of users allowed by NetEase to send mail;
- 554 IP in blacklist The IP is not in the list of sending addresses allowed by NetEase.
Confirmed my guess.
You should have an email address, which can use the smtp port to send mail. Because the user name and password for logging in to the smtp server must be explicitly entered in the command line of the terminal when sending emails, there are certain security problems, so it is recommended that you apply for a free email system. I use yahoo mail.
apt-get install libio-socket-ssl-perl libnet-ssleay-perl sendemail
Instructions:
sendemail -f ADDRESS [options]
Detailed parameters:
- f ADDRESS #Sender's address, note that this address should be your real address
- t ADDRESS #receiver's address
- u SUBJECT #theme
- m MESSAGE #Message body
- s SERVER[:PORT] #SMTP server address and port
- a FILE [FILE ...] #annex
- cc ADDRESS [ADDR ...] #CC address
- bcc ADDRESS [ADDR ...] #Secret copy address
- xu USERNAME #SMTP server user name
- xp PASSWORD #SMTP server password
- o #Other options
If I use yahoo mailbox as the mail sending server, I need to send the use method of sendemail command to my mailbox as an attachment:
man sendemail > sendemail.usage.txt
sendemail -f [email protected] -t [email protected] -u "Instructions for use of sendemail"-m "Instructions for use of sendemail详解。"-s smtp.mail.yahoo.com -o tls=yes -xu [email protected] -xp password-a sendemail.usage.txt
Note: The -o tls=yes
option means that the server requires SSL authentication.
Recommended Posts