Set up the SMTP server under Linux and send the message with the Mail command fine solution

Source: Internet
Author: User

Set up an SMTP server under Linux and send mail using the Mail command fine-Solution steps:

1.vi/etc/mail.rc

    1. Append the following to the end:

set smtp=smtp.domain.com    //Select the public mail domain name
set [email protected]    //default Outgoing mail user
set smtp-auth-password=password    //corresponds to the default user's password
set smtp-auth=login        //Using login

By default

can also be written

Set [email protected] smtp=smtp.domain.com [email protected] Smtp-auth-password=password Smtp-auth=login

3. Save exit

4.mail-s "Custom message header Content" Recipient mailbox < Send content full path (belongs to file for mail sending)
or echo ' Custom file content ' | mail-s "Custom message header Content" Recipient mailbox (send content with Echo and | From the definition file)



Example Demo:

[[email protected] ~]# vi/etc/mail.rc (detailed steps for input)

[Email protected] ~]# tail-5/etc/mail.rc

Fwdretain subject date from to


# for Linux and BSD, this should is set.

Set Bsdcompat

Set from=chun_we***@163.com smtp=smtp.163.com smtp-auth-user=chun***u smtp-auth-password=chunw***985 smtp-auth= Login

[Email protected] ~]#

[Email protected] ~]# mail-s "Mail Test" chun*** @foxmail. com </etc/hosts

[[email protected] ~]# echo "hello,* Test auto Mail" |mail-s "test Write" 791***[email protected]

Mail receive map See attachment


Special Reminders :

Set Smtp-auth-password=password password some mail can be directly with the mailbox login password, some to reset the IMAP/SMTP, etc., different public mailboxes provided by the protocol or permissions are not the same, we recommend the use of @163.com


This article is from the "5chunwei" blog, be sure to keep this source http://5chunwei.blog.51cto.com/11136002/1758685

Set up the SMTP server under Linux and send the message with the Mail command fine solution

Related Article

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.