How to send mail using sendemail on ubuntu

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.

premise##

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.

installation##

apt-get install libio-socket-ssl-perl libnet-ssleay-perl sendemail

use##

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

Example##

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

How to send mail using sendemail on ubuntu
How to install Java on Ubuntu 16.04 using Apt-Get
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
CentOS 6/7 configure sendEmail to send mail
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to deploy Django on Ubuntu 14.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to secure Nginx on Ubuntu 14.04
How to install MariaDB on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to uninstall software on Ubuntu
How to install OpenCV on Ubuntu 20.04
How to install Spotify on Ubuntu 20.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
How to add swap space on Ubuntu 20.04
How to install Docker Compose on Ubuntu 18.04
How to install Ubuntu on Raspberry Pi
How to set up Gogs on Ubuntu 14.04