Ubuntn install sendmail and send the hard disk space information to the specified mailbox

Source: Internet
Author: User

Unzip tn install sendmail and send the hard disk space information to the specified mailbox. 1. Install the sendmail function in ubuntu to send emails conveniently. ubuntu sendmail must first install two packages. Two packages that must be installed: sudo apt-get install sendmail-cf. the following packages are optional: squirrelmail // provides webmail spamassassin // provides Mail Filter mailman // provides a Mail List support dovecot // provides IMAP and POP receiving mail server daemon. Note: to use the most commonly used mail function in Ubuntu, you need to install mailutils. Run the following command on the terminal: ps aux | grep sendmail. The output is as follows: root 20978 0.0 0.3 8300? Ss sendmail: MTA: accepting connections root 21711 0.0 0.1 3008 776 pts/0 S + grep sendmail indicates that sendmail has been successfully installed and started. 2. By default, sendmail is configured to only send emails to local users, only by extending it to the Internet can it become a real mail server. Open the configuration macro file of sendmail:/etc/mail/sendmail. mc vi/etc/mail/sendmail. mc finds the following line: DAEMON_OPTIONS ('family = inet, Name = MTA-v4, Port = smtp, Addr = 127.0.0.1 ') dnl modifies Addr = 0.0.0.0, indicating that you can connect to any server. Generate a new configuration file: # cd/etc/mail # mv sendmail. cf sendmail. cf ~ // Make a backup # m4 sendmail. mc> sendmail. cf //> there is a space between the left and right, prompting that the sendmail-cf is not installed. 3. Test the commonly used mail sending method: 1. how to Write a general mail: mail test@126.com Cc edit Cc object, Subject: mail Subject, enter the carriage return, mail body, press Ctrl-D to end 2. fast sending method: echo "mail body" | mail-s mail subject test@126.com 3. mail-s test test@126.com <test.txt 4. send email with attachment: uuencode attachment name attachment display name | mail-s mail subject Sending address example: uuencode test.txt | mail-s Test test@126.com installation command: sudo apt-get in Stall mailutils to use the function with attachments, you also need to install sharutils, the installation command: sudo apt-get install sharutils; (yum install sharutils) implement a small function (send the space information of the hard disk to the specified mailbox through shell. In this case, you can use a scheduled task to send the desired server information to the mailbox every day .) root @ liujie-VirtualBox:/home/postgres/shell # vim SendMail. sh #! /Bin/bashdf-hl> data.txt mail-s sendMail 751247439@qq.com <data.txt we can use crontab to do a scheduled task, this is perfect.
 

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.