SENDMAIL

From My Admin Page
Jump to: navigation, search

Misc

  • Show Version: /usr/sbin/sendmail -d0.1 -bt < /dev/null
  • How to manually parse the mail queue: sendmail -q -v
In an alternate queue(directory): sendmail -oQ/var/spool/<directory> -q -v
mailq | grep "  (" | sed 's/\(8BITMIME\|    7BIT\)/        /' | sort | uniq -c
  • Useful parameters in /etc/mail/submit.cf and sendmail.cf
    • Dj <- to explicitly define the domain name (also defines hosts name)
    • DS <- Smart Relay host (usually is null)
    • DR <- WHo to send unqualified names to
These can be defined in *.mc as :
define(`SMART_HOST', `mailhost.<host>.<domain>')
define(`confDOMAIN_NAME', `mailhost.<host>.<domain>')dnl

Scripts

Below are several useful scripts obtained from HERE:

Removal

The proper way to remove messages from the mail queue is to use the qtool.pl program included in the contrib subdirectory of the Sendmail source code distribution. qtool.pl uses the same file locking mechanism as Sendmail. The scripts below utilize qtool.pl

  • Double Bounce Script. This removes "double bounce" messages. A "double bounce" is a message that is addressed to a non-existent user and that is sent from an invalid return address.
  • Remove Mail by Domain. This will remove all mail in the mail queue addressed to domain. Messages with multiple envelope recipients to different domains will not be deleted.
  • Remove Mail by TO: Address. This will remove all mail in the mail queue addressed to email_address. Messages with multiple envelope recipients will not be deleted.
  • To modify the remove "by TO: address" script to be "FROM:" Change search line to
 if ( /^S<(.*)>$/ ) { 

Search

  • Queued by Domain Name. This show all queued mail by domain. A message may be counted more than once if it has multiple envelope recipients from different domains.
  • Queued by Email Address. This will show all queued mail by email address. A message may be counted more than once if it has multiple envelope recipients.