Linux system uses command line to send mail

Source: Internet
Author: User

Environment

The machine was installed SendMail, but did not start. Mail server is on the other machine, and it has been added to the open relay list and can be sent through this mail server.

Download Address http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

The code is as follows Copy Code

#tar –ZXVF sendemail-v1.56.tar.gz
#cd sendemail-v1.56
#cp Sendemail/usr/local/bin

Then give confirmation that it has execute permissions

The code is as follows Copy Code

Ll/usr/local/bin/sendemail
-rwxr-xr-x 1 root root 77882 11-03 14:23/usr/local/bin/sendemail

The procedure is as follows:

1. Install SENDMAIL-CF Package
2. Modify/ETC/MAIL/SUBMIT.MC
1 FEATURE (' MSP ', ' [127.0.0.1] ') DNL

2 amended to

3 FEATURE (' MSP ', ' [Your mail server IP] ') DNL

3. Execute make in/etc/mail/directory

Test

The code is as follows Copy Code

Mail-s ' Hello www.111cn.net world! ' user1@chxbd.com

Bin/mail will use the local sendmail to send mail by default, which requires local machines to install and start the SendMail service, is cumbersome to configure, and can result in unnecessary resource consumption.

If you don't, we can close sendmail.

Turn off the SendMail service

  code is as follows copy code

a.[ Root@sample ~]#/etc/rc.d/init.d/sendmail stop← close SendMail service
or [root@sample ~]# service sendmail stop← closed sendmail suit Service
Shutting down sendmail: [OK]
shutting down sm-client: [OK]
B.[root@sample ~]# chkconfig sendmail-off← Turn off SendMail
c.[root@sample ~]# chkconfig--list sendmail← confirm that SendMail has been turned off since startup (all is OK)
SendMail 0:off 1:off 2:o FF 3:off 4:off 5:off 6:off

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.