Send an email through the command line in Ubuntu

Source: Internet
Author: User

The article is mainly reference http://www.cnblogs.com/276815076/archive/2011/10/11/2207214.html

Verify that the message has been sent successfully. Please try it out, but you will be at your own risk.

Needless to say, install the software first. We all know about ubuntu. You can use sudo apt-Get install mutt msmtp as a silly sudo. You just need to set everything by default.

Next, start various configurations, which are very simple and don't bother. You can copy them. Of course, I also use Ctrl + C.

Mutt
System global settings/etc/muttrc. If you use a system user, you can ~ /. Muttrc.

Vi. muttrc
Set Sendmail = "/usr/bin/msmtp"
Set use_from = Yes
Set realname = "fengyubin"
Set From = fyb@163.com
Set envelope_from = Yes

Msmtp
Create ~ /. Msmtprc and ~ /. Msmtp. log, which is the configuration file and Log File respectively.
Vi. msmtprc

Account default
Host smtp.163.com

From fyb@163.com
Auth plainuser fybpassword 123456 logfile ~ /. Msmtp. Log because the password is a clear code, we need to modify the permissions of this file.
Chmod 600. msmtprctouch ~ /. Msmtp. Log

Check whether the SMTP server supports authenticated TLS encryption:

Run the following command: msmtp -- Host = smtp.163.com -- serverinfo and press Enter.

SMTP server at smtp.163.com (m5-86.163.com [202.108.5.86]), port 25:
163. com anti-spam GT for coremail System (163com [20050206])
Capabilities:
Pipelining:
Support for command grouping for faster transmission
Auth:
Supported authentication methods:
Plain Login

Here, you can use mutt to send an email. Let's test it.

Echo "test" | mutt-s "my_first_test"
* ** @ Gmail.com

Go to the mailbox and check whether the email is successful!

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.