Use the mutt and msmtp command lines in Linux to send emails

Source: Internet
Author: User
Tags test email address
In Linux, use the mutt and msmtp command lines to send emails-Linux Enterprise Application-Linux server application information. The following is a detailed description. I used to use the mail command to send emails all the time, but it is very troublesome to configure. Many things of sendmail need to be configured. In addition, sendmail must be enabled to ensure that the mail is successfully sent. Is there any mail client software like foxmail and outlook that can send emails in the form of command lines. Mutt and msmtp provide a good solution.

The configuration scheme is as follows:

1) download msmtp

Wget http://downloads.sourceforge.net... 206451 & big_mirror = 0

2) decompress:

Tar jxvf msmtp-1.4.16.tar.bz2

3) installation:

./Configure -- prefix =/usr/local/msmtp

Make

Make install

4) configure the msmtp account:

Create a file/usr/local/msmtp/etc/msmtprc

Edit content:

# Set default values for all following accounts.

Ults

# The SMTP server of the provider.

Account test

Host sending email server name

Email sent from

Auth login

User email server Logon account

Password email server login password

# Set a default account

Account default: test

5) Save and exit to test whether the client is available

/Usr/local/smtp/bin/msmtp target email address

Enter some characters and press ctrl + D to exit. Go to the target email address and check whether the email is received.

6) Configure mutt. Generally, mutt is installed by default in linux. You can use which mutt to view the mutt installation path.

Edit the mutt configuration file:/etc/Muttrc and modify the following lines:

Set sendmail = "/opt/msmtp/bin/msmtp"

Set use_from = yes

Set realname = "sending email address"

Set editor = "vi"

7) Save and exit, and test whether mutt is valid:

Echo "test" | mutt-s "test" test email address

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.