Linux under configuration with MSMTP and mutt email

Source: Internet
Author: User
Tags bz2

Linux can be sent directly by mail commands, but the sender is [email protected], if the machine does not have an extranet DNS, others can not reply. At this point, it is important to have a mail-sending program that can use the free e-mail service. MSMTP is a program like this.


#1, download the source package


wget http://sourceforge.net/projects/msmtp/files/msmtp/1.4.31/msmtp-1.4.31.tar.bz2/download


#2, unzip


TAR-JXVF msmtp-1.4.31.tar.bz2 && CD msmtp-1.4.31


#build and install


./configure--prefix=/usr/local/msmtp && make && make install


#link To/usr/bin


Ln-s/USR/LOCAL/MSMTP/BIN/MSMTP/USR/BIN/MSMTP


#3, new configuration file for Msmtp


Mkdir/usr/local/msmtp/etc


mkdir/var/log/msmtp/


Vim/usr/local/msmtp/etc/msmtprc


#4, enter the following:


# Set default values for all following accounts.

Defaults


Logfile/var/log/msmtp/msmtp.log

# The SMTP server of the provider.

Account 163


# SMTP mail server address

Host Smtp.163.com


# e-Mail Email

From [email protected]

Auth Login


# Mail Server login account

User [email protected]


# Mail Server login password

Password Password

# Set a default account

Account default:163


#5, test MSMTP is configured correctly


MSMTP [email protected]

[Ctrl+d]


#6, installation configuration mutt

Yum Install-y Mutt

Vim/etc/muttrc



#输入如下内容:

Set sendmail= '/usr/bin/msmtp '

Set Use_from=yes

Set Realname= "[Email protected]"

Set [email protected]


Well, let's test it out!

echo "Testmail" | Mutt-s "Test"-a/etc/hosts [email protected]

Here's-a refers to the addition of attachments, if it is multiple attachments, add a few-a file name

I can do that.

Mutt-s "Test"-a/etc/hosts-a/etc/apple [email protected] </tmp/imax.txt

This means to use the contents of the/tmp/imax.txt file as the content of the message.

echo "This is the body" | Mutt-s "Testing" [email protected]-a/etc/hosts-a/etc/apple

All right, that's easy.


Linux under configuration with MSMTP and mutt email

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.