How to send mail via command line mail in Centos

Source: Internet
Author: User
Tags how to send mail
In linux, the command line mail method 1. the simplest method is: mail-stext ** @ mail.ustc.edu.cn. the result of this command is to send an empty message titled text to the mailbox, however, this type of mail is often treated as spam. if you do not receive the mail, you are advised to open the recycle bin to check it. the first method, you can

How to send mail via command line in linux

1. the simplest method:

Mail-s text ** @ mail.ustc.edu.cn

The result of this command is to send an empty email with the title text to the mailbox, but such emails are often treated as spam emails,

If you do not receive an email, we recommend that you open the recycle bin to check the information. The first method is to use the current shell as an editor,

After the content is edited, Ctrl-D.

2. practical mail sending method.

# Method 2: Use the pipeline command

Echo "This is a test mail !" | Mail-s text ** @ mail.ustc.edu.cn

# Method 3: use redirection.

Mail-s test ** @ mail.ustc.edu.cn <file

To send a mail with the file content, first select to write a document in advance and then mail it in the past.

3. email sending with attachments (important)

If you do not have the uuencode command in your system, you need to install sharutils first,

Sudo apt-get install sharutils.

Uuencode requires two parameters. The first is the file you want to send. of course, this can also be done using pipelines, and the second is the file name displayed.

Uuencode/home/daniel/httpd. conf httpd. conf | mail-s mailtest ** @ mail.ustc.edu.cn

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.