Sendmail Usage


Table of Contents

cmd:sendmail 
Usage 
Delivery status 
Talk to the MTA 
Help 
Why is my RH pausing for such a long time at "starting sendmail" during reboot? 
Why is my RH pausing for such a long time at "starting sendmail" during reboot? 
Why is my RH pausing for such a long time at "starting sendmail" during reboot? 
Mail problem 

cmd:sendmail 

Usage 

To send the mail queue, type

/usr/sbin/sendmail -q

To check the mail queue, type

/usr/sbin/sendmail -bp

checking 

mailq

Sending 

cat whatever | (echo "To: MyFriends@everywhere.net"; echo ; cat - ) | sendmail -f addr@host.com recipients...

or,

date  | sendmail -f $SNDF $USER

— directly pipe through, no extra echo & () needed!

probing & testing 

$ date  | /usr/lib/sendmail -v $USER

Maintaining 

$ /usr/lib/sendmail -bp
           Mail Queue (1 request)
--Q-ID-- --Size-- -----Q-Time----- ------------Sender/Recipient------------
QAA12586       28 Fri Jun  2 16:27 tong
                 (Deferred)
                                   "|IFS=' '&&p=/.../procmail
% dir /var/spool/mqueue
total 2
-rw-------   1 root     tong           28 Jun  2 16:27 dfQAA12586
-rw-------   1 root     tong          465 Jun  2 16:27 qfQAA12586
% rm /var/spool/mqueue/??QAA12586
$ /usr/lib/sendmail -bp
Mail queue is empty

Delivery status 

Query status 

sendmail -bp

Request to send 

sendmail -q [-v]

help 

-bp    Print a listing of the queue.
-q[time]
Processed saved messages in the queue at given intervals.  If
time is omitted, process the queue once.  Time is given as a
tagged number, with `s' being seconds, `m' being minutes, `h'
being hours, `d' being days, and `w' being weeks.  For
example, `-q1h30m' or `-q90m' would both set the timeout to
one hour thirty minutes.  If time is specified, sendmail will
run in the background.  This option can be used safely with
-bd.

or

mailq
If invoked as mailq, sendmail will print the  contents  of  the  mail
queue.
DeliveryMode=x
Set the delivery mode to x.  Delivery modes are `i' for
interactive (synchronous) delivery, `b' for background
(asynchronous) delivery, `q' for queue only - i.e., actual
delivery is done the next time the queue is run, and `d' for
deferred - the same as `q' except that database lookups for
maps which have set the -D option (default for the host map)
are avoided.

Talk to the MTA 

http://www.sektorn.mooo.com/era/mail/procmail-debug.html

To see whether the MTA is willing to accept mail for the user in question, you need to have shell access on the mailhost and run this there:

$ sendmail -bv username
username... deliverable: mailer local, user username

If you get an answer mentioning a remote host name and so forth, it means you are on the wrong host, and need to figure out where the mail ultimately gets delivered.

To actually try to deliver something and watch while Sendmail is doing it, try this:

$ sendmail -v username </dev/null
username... Connecting to local...
username... Sent

If there is an error, sendmail will be delivering a bounce message back to you using normal means.

Help 

-F fullname    Set the full name of the sender.
-f name        Sets the name of the "from" person (that  is,
               the sender of the mail).
-t             Read message for recipients.  To:,  Cc:,  and
               Bcc: lines will be scanned for people to send
               to.  The Bcc: line  will  be  deleted  before
               transmission.   Any addresses in the argument
               list will be suppressed.
                 To protect privacy, make
               sure that messages always include  a  minimal
               To:  line,  even if it is a dummy line with a
               comment, such as
To: (names withheld)
-bp            Print a summary of the mail queue.
-bv            Verify names only; do not try to  collect  or
               deliver  a  message.  Verify mode is normally
               used for validating users or mailing lists.
-d X           Set debugging value to X.
-C file        Use alternate configuration file.
-o xvalue      Set option x to the  specified  value.   Pro-
                cessing Options are described below.
Processing Options
  There are a number of "random" options that can be set  from
  a  configuration  file.   Options  are represented by single
  characters.  The syntax of this line is:
Oovalue
This sets option o to be value.  Depending  on  the  option,
value may be
               o a string
               o an integer
               o a boolean (with legal values t, T, f, or F;
                 the default is TRUE)
               o a time interval
The options supported are:
aN             If set, wait up to N  minutes  for  an  "@:@"
f              Save Unix-style From lines at  the  front  of
               headers.  Normally they are assumed redundant
               and discarded.
l              If there is an Errors-To:  header, send error
               messages to the addresses listed there.  They
               normally go to the envelope sender.   Use  of
               this  option  causes  sendmail to violate RFC
               1123.
Ln             Set the default log level to n.  Defaults  to
               9.
-B type        Indicate body type (7BIT or 8BITMIME).
-M id          Attempt to deliver the  queued  message  with
               message-id  id.  This option is supported for
               backward compatibility and the -qI option  is
               preferred.
-v             Go into verbose mode.  Alias expansions  will
               be announced, and so forth.
-X logfile     Log all traffic in and out of sendmail in the
               indicated  logfile for debugging mailer prob-
               lems.  This  produces  a  lot  of  data  very
               quickly and should be used sparingly.