Sendmail

From The System Administrator Zone

Some basic commands

List mail queue

sendmail -bp

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

mailq

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 user@example.com


Manually sending mail with sendmail

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

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

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.org Sendmail Wikipedia sendmail faq.org

Sendmail Related Books

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