Linux sends mail via SMTP

Source: Internet
Author: User

Recently, using the Mail Service on a project, the mail service that comes with it can send messages, but after testing, the addresses that are sent are not regular messages. Originally wanted to lazy use of sendmail, but the old was blocked, so had to use third-party authorization to send mail, the following is my ubuntu12 on the operation

    1. Basic Environment

[Email protected]:/home/lt5# cat/etc/issueubuntu 14.04.5 LTS \ \l[email protected]:/home/lt5# uname-alinux lt5 4.4.0-31 -generic #50 ~14.04.1-ubuntu SMP Wed Jul 01:07:32 UTC x86_64 x86_64 x86_64 gnu/linux


2. Install the software HEIRLOOM-MAILX

[Email protected]:/home/lt5# apt-get Install HEIRLOOM-MAILX


3. Modify the configuration file/etc/nail.rc

[Email protected]:/home/lt5# tail-7/etc/nail.rc # added by summer at 2017-01-21set [email protected] #要换成你的163 Mailbox set Smtp=smtp.163.comset [email protected] #换成你的163邮箱set Smtp-auth-password=sdxdsxds #换成你的163邮箱对应的授权码set Smtp-auth-login#end

Configuration file Description Explanation

From is the e-mail address sent
SMTP is the address of the external SMTP server that occurs
Smtp-auth-user is an external SMTP server authenticated user name
Smtp-auth-password is the user password for external SMTP server authentication
Smtp-auth is the way of email authentication


Note: For 163 of the authorization code of the things themselves Baidu, or the following operations can be.

I use the external SMTP mailbox is NetEase 163 mailbox, the delay relative to QQ will be smaller

sign in to 163 mailboxes, set up in 163 mailbox and general settings-->pop3/smtp/imap turn on the above three services and choose to receive all messages, in 163 mailbox settings-General Settings-- Client Password Authorization Note the Client authorization password (a string of characters, it is important)


5. Send mail test

[Email protected]:/home/lt5# mailx-s ' test a mail ' [email protected] </etc/hosts

Explanatory notes

1.-S is the subject of the following email

2. [email protected] is to receive email address, I have hidden, just add the eamil you need to

If you want to send more people, the middle plus a comma can

3. </etc/hosts is the message you want to send, which is the body of the recipient's message.

e-mail content received by recipient below

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/8D/09/wKiom1iCy5uiRzcAAAFMKoqb6QE966.png-wh_500x0-wm_3 -wmp_4-s_1529522096.png "title=" 1.png "alt=" Wkiom1icy5uirzcaaafmkoqb6qe966.png-wh_50 "/>


Linux sends mail via SMTP

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.