Tips and Tricks for Sendmail
mailq – Prints the mail queue's contents, same as /usr/lib/sendmail –bp
newaliases – Rebuilds the aliases database file, same as /usr/lib/sendmail –bi
hoststat – Prints persistent host status info, same as /usr/lib/sendmail -bh
purgestat – Purges (zeroes) persistent host status info, same as /usr/lib/sendmail -bH
smtpd – Runs in daemon mode, same as /usr/lib/sendmail –bd –q30
mailq –OmaxQueueRunSize=1 - Quickly print the total number of messages within mail queue
/usr/lib/sendmail –q –Otimeout.queuereturn=99d - Purges the mail queue without timing out any messages. Useful if the mail server has been down longer than the queuereturn value set in the cf.
/usr/lib/sendmail –bv foolist | grep –v deliverable - Prints only undeliverable addresses from in the mail list foolist. Great for use in a shell script to remove badd addresses from a mailing list.
Command Line Switches
-B 7bit - Causes sendmail to clear the high-bit of every incoming byte.
-B 8bitmime – Causes sendmail to preserve the high-bit or every incoming byte.
-ba – Uses ARPAnet/Grey-Book protocols to transfer mail.
-bD – Runs as daemon, like –bd, but does not fork and does not detach from controlling terminal.
-bd – Runs as daemon, forks and detaches.
-bH - Purges (zeroes) persistent host status info.
-bh - Prints persistent host status info.
-bi - Initializes the aliases database.
-bm – Causes sendmail to read and send message (this is the default)
-bp – Prints the contents of the mail queue.
-bs – Runs sendmail on standard I/O.
-bt – Runs sendmail in rule testing mode.
-bv - Verifies address.
-C /tmp/different.cf – Uses different.cf as its configuration file.
-c - Sets HoldExpensive option to true.
-d- set debug mode. - Set senders address
* -d0 – Shows general config
* -d0.1 – Prints version
* -d.04 – Prints local hostname and any aliases for it.
* -d0.15 – Prints the list of delivery agents declared
* -d0.20 – Prints address of each network interface
* -d8 – Traces most DNS lookups
* -d8.1 – Prints failure of low level MX searches.
* -d8.2 – Prints calls to getcanonname
* -d8.3 - Traces dropped local hostnames
* -d8.5 – Shows hostnames tried in getcanonname
* -d8.8 – Shows when MX lookups return the wrong type.
* -d11 – Traces delivery agent calls
* -d11.1 – Traces arguments passed to the delivery agent
* -d11.2 - Prints the user ID that the delivery agent is invoked as
* -d21 – Traces rewriting of addresses
* -d21.1- Traces general ruleset rewriting
* -d21.2 – Traces use of $& macro
* -d21.3 – Shows $> subroutines called
* -d21.4 – Displays result of rewrite
* -d21.15 – Shows $digit replacement
* -d21.35 – shows token by token LHS matching
* -d27 – Traces aliasing
* -d27.1 – Traces general aliasing
* -d27.2 – Traces :include: files, alias self-references, and errors on home
* -d27.3 – Traces the ~/.forward path and the alias wait
* -d27.4 – Prints "not safe" when a file is unsafe to trust
* -d27.9 – Shows uid/gid changes when reading :include: files
* -d35 – Traces macros
* -d35.9 shows macro values as they are defined
* -d35.14 – Shows macro names being converted to integer id’s
* -d35.24 – Shows macro expansion
* -d37 – Traces options and class macros
* -d37.1 – Traces the setting of options
* -d37.8 – Traces the adding of words to a class
* -d41 – Traces the queue
* -d41.1 – Traces queue ordering
* -d41.2 – Shows failure to open qf files
* -d41.49 – Shows skipped queue files
* -d41.50 – Show every file in queue
-F- Set senders full name
-f
-h- Set minimum hop count
-i – Set IgnoreDots option to true
-M- Set macro
-N- Set return DNS notify information
* never – Never return the info
* success – Return on successful delivery
* failure – Return on failure
* delay – Return on delayed delivery
-n – Supresses aliasing
-O
Wednesday, October 7, 2009
Sendmail Quick Reference
Subscribe to:
Posts (Atom)