Use msmtp to send emails through scripts

Source: Internet
Author: User
Tags email account
Using msmtp to send emails via scripts such as sedmail and postfix is to configure the server as an email server, while msmtp is equivalent to a mail client (foxmail, outlook, and other clients ), we can apply for an email account from NetEase through simple configuration... using msmtp to send emails via scripts such as sedmail and postfix is to configure the server as an email server, while msmtp is equivalent to a mail client (foxmail, outlook, and other clients ), we can apply for an email account from NetEase and set it through simple configuration. Install. Wget http://pkgs.fedoraproject.org/repo/pkgs/msmtp/msmtp-1.4.29.tar.bz2/87cc6f37cb7a163ceb89382932e41535/msmtp-1.4.29.tar.bz2 Tar xvf msmtp-1.4.29.tar.bz2cd msmtp-1.4.29./configure -- prefix =/usr/local/msmtpmake & make install configuration. Mkdir/usr/local/msmtp/etc/use vi to open the msmtprc file and enter the following content (vi/usr/local/msmtp/etc/msmtprc) defaultsaccount jackhost smtp.163.com # NetEase smtp server, you can also select another mailbox server and account domain 163. comfrom jack@163.com # corresponding mailbox account auth loginuser jack@163.compassword jack123 # corresponding password account default: jack was installed here you can use msmtp, however, you can only display the subject and sender of an email by using msmtp, but the content is blank (the reason is to be found). Therefore, you can use mutt to reference msmtp to send emails. In general, mutt is installed by default. if it is not installed in the system, you can install it using yum-y install mutt. Open the mutt configuration file and modify the following four items (vi/etc/Muttrc ). 1. set sendmail = "/usr/local/msmtp/bin/msmtp" 2.set use_from = yes3.set realname = jack@163.com # The Mailbox account 4.set editor = "vi" configured above is now, we can test the command to send an email. Echo "Mail content" | mutt-s "Mail subject" jack@163.com or you can write the Mail content in the file: cat file.txt | mutt-s "Mail subject" jack@163.com uses the mutt command in the script to enable automatic mail sending.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.