Use msmtp + mutt + shell to send emails

Source: Internet
Author: User
Use msmtp + mutt + shell to send an email-Linux Enterprise Application-Linux server application information. The following is a detailed description. Today, I had nothing to do in the dormitory, and I was bored. I had to study some things. I turned on my computer and found that the msmtp I downloaded for a long time had not been studied. Haha, because I have already used perl to solve my problem, however, there is a better solution. Start of work. Solve the problem.

1. Compile the software.
Tar jxvf msmtp-1.4.13.tar.bz2
./Configure -- prefix =/opt/msmtp
Make
Make install

2. Check where the configuration file is located.
[Root @ server bin] #./msmtp -- version
Msmtp version 1.4.13
TLS/SSL library: none
Authentication library: built-in
Supported authentication methods:
Plain cram-md5 (external login)
IDN support: disabled
NLS: enabled, LOCALEDIR is/opt/msmtop/share/locale
System configuration file name:/opt/msmtp/etc/msmtprc ----- Haha, this is my own
User configuration file name:/root/. msmtprc
Copyright (C) 2007 Martin Lambers and others.
This is free software. You may redistribute copies of it under the terms
The GNU General Public License .
There is no warranty, to the extent permitted by law.

3. Configure the msmtp configuration file.
[Root @ server etc] # more msmtprc
# Set default values for all following accounts.
Ults
Logfile/opt/msmtp/log/msmtp. log ------- the file must exist. Otherwise, no log exists.
# The SMTP server of the provider.
Account sohu
Host smtp.sohu.com
From your_account@sohu.com
Auth login ------- this is login. It seems that on does not work.
User your_account
Password your_password
# Set a default account
Account default: sohu
When you get there, you 'd better test it first.
/Opt/msmtp/bin/msmtp yehaozi@gmail.com
Hello, test
Ctrl + d
Tail-f/opt/msmtp/log/msmtp. log to check whether the operation is successful.
Then go to the preceding email to see if the email has been received.

4. Configure mutt
I used to see mutt + msmtp sending emails on the Internet. I don't want to install mutt. (Khan, the system was installed only later ). I have been searching for how to use msmtp to send emails by myself. Emails can be sent, but there are too few functions. Use the mutt that has been installed.

[Root @ server bin] # tail-5/etc/Muttrc
Set sendmail = "/opt/msmtp/bin/msmtp"
Set realname = "actor"
Set use_from = yes
Set editor = "vi"

5. Now we have everything done. Let's test it.
[Root @ server bin] # echo "test" | mutt-s "" yehaozi@gmail.com

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.