From The System Administrator Zone
Revision as of 21:52, 17 August 2009 by BobVanCleef (talk | contribs) (Sendmail Related Books)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Some basic commands

List mail queue

sendmail -bp

The mailq command is the same as the sendmail -bp command.


Flush the mail queue

sendmail -q

Delete message with ID XXXXXXXX from the mail queue

This is a hack...

rm /var/spool/mqueue/*XXXXXX*

Is there a quick way to send a test message?

date | /usr/lib/sendmail -Am -v

Manually sending mail with sendmail

Use telnet to connect to port 25 on a mail server. This script shows how.

# Send a test message
# Usage: myscript mailhost
# If ping reachable
if ping -c 3 $1
echo  HELO       # send host name
sleep 1                                # wait 1 seconds for answer
echo MAIL FROM:       # send from address
sleep 1
echo RCPT TO:  # send userid@host
sleep 1
echo DATA
sleep 1
echo this is a test
echo line 2
echo .
echo quit
} | telnet $1 25

None of this information is tested by the mail server, so you can funny-up anything, except the destination e-mail address.

Sendmail Related Web Links Sendmail Wikipedia sendmail

Sendmail Related Books

<amazon>0596510292</amazon> <amazon>0596004710</amazon> <amazon>0596008457</amazon> <amazon>0782127371</amazon> <amazon>0321213335</amazon> <amazon>1409213900</amazon>