Linux steps to send mail through the command line

  
                

In the Linux system, you can freely send mail through the command line. You can use the sendmail function and the php mail function. If you don't have the sendmail function, you need to install sendmail on the Linux system. The following small series will introduce you how to use Linux. Send mail.

Environmental

The machine installed sendmail, but did not start. There are mail servers on other machines, and the machine has been added to the open relay list, and mail can be sent through the mail server.

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

Code is as follows

#tar &ndash ;zxvf sendEmail-v1.56.tar.gz

#cd sendEmail-v1.56

#cp sendEmail /usr/local/bin

Then give confirmation to confirm it With execute permission

The code is as follows

ll /usr/local/bin/sendEmail

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

Here's how:

1. Install the sendmail-cf package

2. Modify /etc/mail/submit.mc

1 FEATURE(`msp‘’, `[127.0.0.1]‘’)dnl

2 Modified to

3 FEATURE(`msp‘’, `[Your Mail server ip]‘’)dnl

3. Execute make

in the /etc/mail/directory Test

Code is as follows

mail -s ‘’hello www.xitongzhijia.net world! ‘’ [email protected]

bin/mail will use local sendmail to send mail by default, which requires the local machine to install and start the Sendmail service. The configuration is very troublesome and will bring unnecessary resources. Occupied.

If you don't need it, we can turn off sendmail

Close the sendmail service

The code is as follows

a.[root@sample ~]# /etc/rc .d/init.d/sendmail stop ← Close the sendmail service

or [root@sample ~]# service sendmail stop ← Close the sendmail service

Shutting down sendmail: [ OK ]< Br>

Shutting down sm-client: [ OK ]

b.[root@sample ~]# chkconfig sendmail off ← Turn off sendmail self-starting

c.[root@sample ~]# chkconfig --list sendmail ← Confirm that sendmail has been started since it was started (all are off)

sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6 :off

The above is the introduction of Linux using the command line to send mail. After installing sendmail, you need to modify the files in the directory and perform a simple test on sendmail.

Copyright © Windows knowledge All Rights Reserved