Define The reque
Mailer In The Standard
/etc/sendmail.cf
file
##################################### ### Reque Mailer specification ### ##################################### # Pass these messages back to sendmail with alternate queue directory # Use SMTP to pass the message back to a second sendmail daemon # listening to port 26 (or some other unused port) on this host $j # Note the k mailer flag to disable the smtp loopback check Mreque, P=[IPC], F=kmDFMuXa, S=11/31, R=11/31, E=\r\n, L=2040, T=DNS/RFC822/SMTP, A=IPC $j 26 # No mailer specific rulesets because mailer uses esmtp mailer rulesetsYou may also want to add the reque name to the
/etc/services
file
/etc/services: smtp 25/tcp mail reque 26/tcp mailIf you do this the
A=
line can use reque
rather than 26
:
A=IPC $j reque
Define Problem Domains For The Reque Mailer
# Class $={RequeDoms} is the parent domains that we are having SMTP # delivery problems with # Pass these messages back to sendmail by using SMTP to connect to port 26 # Define these within the sendmail.cf file itself C{RequeDoms} aol.com # Define these in a separate file F{RequeDoms} -o /etc/mail/RequeDoms # macro $P is for requeuing mail for a specific host or domain # by manually invoking sendmail: # sendmail -q -v -MPproblem.domain # This macro is not defined in the sendmail.cf file
Pass Mail For Problem Domains To Reque Mailer
In rulesetS0
(S98
would be a logical choice)
# Requeue mail for recipient addresses to problem domains $=R by # passing them to the reque mailer which calls sendmail with # an alternate mqueue directory R$* < @$={RequeDoms} . > $* $#reque $@ $2$3 $:$1<@$3.>$4 R$* < @$+ . $={RequeDoms} . > $* $#reque $@ $2$3 $:$1<@$2.$3.>$4
Requeue Mail For Problem Domains From The Command Line
If you want to be able to reque mail for a specific host or domain by manually invoking sendmail add this in ruleset S0 (again S98 would be a logical choice)# Reque mail for a specific host or domain defined by manually invoking # sendmail with -oMPproblem.dom or -MPproblem.dom #Then to requeue to a specific problem domain run:Test if macro $P has been set
R$+ < @$+ > $: $1 < @$2 @$P > # If noting after second @ sign, $P not set, strip second @ R$+ < @$+@ >
$1 < @$2 > # Other wise $P had a value, test if recipient domain ends with $P R$+ < @ $P . @$P > $#reque $@$P $:$1 < @ $P. > R$+ < @$+ .$P . @$P > $#reque $@$2.$P $:$1 < @ $2.$P. > R$+ < @ $P @$P > $#reque $@$P $:$1 < @ $P > R$+ < @$+ . $P @$P > $#reque $@$2.$P $:$1 < @ $2.$P > # Recipient domain did not end with $P, strip second @ $P in address R$+ < @$+ @$P > $1 < @$2 >
sendmail -q -MPprodigy.comOr run it as an queue daemon:
sendmail -q10m -MPprodigy.com
Create The Reque sendmail.cf
File
Copy the original sendmail.cf file without the previous changes:
cp /etc/sendmail.cf.orig
/etc/sendmail.cf.reque
Change the SMTP daemon options to listen to another port (port
26
is a logical choice)
# SMTP daemon options #OOPort=esmtp O DaemonPortOptions=Port=26
Change the mqueue directory to spool the mail in a different directory
# queue directory #OQ/var/spool/mqueue O QueueDirectory=/var/spool/mqueue.reque
Change the default delivery mode to queue
# default delivery mode #Odbackground O DeliveryMode=queue
Change the queue sort order to host
# shall we sort the queue by hostname first? O QueueSortOrder=host
Optionally change the sendmail.cf
file version number to
reflect alternate config file
# Configuration version number DZ-reque
Test The New Configuration
Start the new requeue sendmail
daemon
/usr/sbin/sendmail -bd -q15m
-C/etc/sendmail.cf.reque
Check you syslog
file
If you get the error message:
Jun 11 22:58:47 firewall sendmail[26027]: problem creating SMTP socket
Jun 11 22:58:52 sendmail[26027]: NOQUEUE:
SYSERR(root):
opendaemonsocket: cannot bind: Address
already in use
Then you have not set the DaemonPortOption correctly and
are binding to port 25
Next kill and restart the standard sendmail
daemon:
Check for both sendmail
daemons:
ps -ax | grep sendmail
Normal SMTP server:
2608 ?? Ss 0:00.08 accepting connections on port 25 (sendmail)Requeue SMTP server:
2619 ?? Ss 0:00.06 accepting connections on port 26 (sendmail)
telnet firewall 25 Trying 192.102.231.125 ... Connected to firewall.harker.com. Escape character is '^]'. 220 firewall.harker.com ESMTP Sendmail /8.8.8 ready at Wed, 11 Jun 1997 23:20:50 GMT helo harker.harker.com 250 firewall.harker.com Hello harker.harker.com [192.102.231.1], pleased to meet you mail from: user@example.com 250 user@example.com... Sender ok verb 250 Verbose mode onex 250 Only one transaction rcpt to: userID@aol.com 250 userID@aol.com... Recipient ok data 354 Enter mail, end with "." on a line by itself from: user@example.com to: userID@aol.com test . 050 userID@aol.com... Connecting to firewall.harker.com port 26 via reque... 050 220 firewall.harker.com ESMTP Sendmail /8.8.8-reque ready at Wed, 11 Jun 1997 23:21:50 GMT 050 >>> EHLO firewall.harker.com 050 250-firewall.harker.com Hello root@firewall.harker.com [192.102.231.125], pleased to meet you 050 250-EXPN 050 250-VERB 050 250-8BITMIME 050 250-SIZE 050 250-DSN 050 250-ONEX 050 250-ETRN 050 250-XUSR 050 250 HELP 050 >>> MAIL From:<user@example.com> SIZE=63 050 250 <user@example.com>... Sender ok 050 >>> RCPT To:<userID@aol.com> 050 250 <userID@aol.com>... Recipient ok 050 >>> DATA 050 354 Enter mail, end with "." on a line by itself 050 >>> . 050 250 XAA26203 Message accepted for delivery 050 userID@aol.com... Sent (XAA26203 Message accepted for delivery) 250 XAA26200 Message accepted for delivery 050 Closing connection to firewall.harker.com 050 >>> QUIT 050 221 firewall.harker.com closing connection quit 221 firewall.harker.com closing connection
Check The Reque Directory With mailq
Use the -oQ/var/spool/mqueue.reque
command line flag to print the messages in the reque queue directory
sendmail -bp
-oQ/var/spool/mqueue.reque
or mailq
-oQ/var/spool/mqueue.reque
mailq -oQ/var/spool/mqueue.reque
Mail Queue (1 request) --Q-ID-- --Size-- -----Q-Time----- ---------Sender/Recipient-------- XAA26203 8 Wed Jun 11 23:21 <user@example.com> lt;userID@aol.com>
Finally, modify the host's startup scripts to start the reque SMTP daemon
/etc/rc.local
:
/usr/sbin/sendmail -bd -q11m
-C/etc/sendmail.cf.reque
Putting These Changes Into M4
To put the reque mailer and the reque mailer delivery into aM4
template file you would precede the mailer definition itself with:
MAILER_DEFINTIONS
You would precede the delivery rules with:
LOCAL_RULE_0
You would create the reque alternate sendmail.cf
file by defining the M4
macros to change the options:
A M4 HACK
template for the reque mailer and delivery rulesets
can be found at:
ftp://ftp.harker.com/pub/sendmail/cf/reque.m4
To add the reque mailer to your sendmail.cf
file you would
download
the template either the hack
or feature
sub-directory of the sendmail-8.X/cf
directory. If you
were going to add the reque mailer as a M4 HACK
or
FEATURE
the file would be called:
hack/reque.m4In your
host.mc
file
or feature/reque.m4
This template would be included in your sendmail.cf
file
by including:
HACK(reque) or FEATURE(reque)
in your host.mc
file.
A host.mc
template for the reque daemon itself
can be found at:
ftp://ftp.harker.com/pub/sendmail/cf/reque.mc
To use this template you would need to change the OSTYPE
to match your OS.
Remeber this is the sendmail.cf
file for your reque daemon, not
the sendmail.cf
for your normal prot 25 sendmail
daemon.
Just another "Harker's Helpful Hint" from Harker systems