Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Control SMTP_MAILER_MAXMSGS per domain or host?

155 views
Skip to first unread message

HRil...@gmail.com

unread,
Dec 5, 2007, 9:48:07 PM12/5/07
to
All,

We need to be able to control the number of messages that get sent in
a connection to remote servers. I figure this should be possible by
something in the access db, but can't figure out how. Can anyone
assist?

Thanks.

Per Hedeland

unread,
Dec 6, 2007, 4:52:23 PM12/6/07
to
In article
<eaf9817b-c700-4169...@l1g2000hsa.googlegroups.com>

Not in access db, but you can use mailertable to choose different
mailers based on the destination. If you only need one or two values you
can set SMTP_MAILER_MAXMSGS and/or RELAY_MAILER_MAXMSGS and choose
'esmtp' or 'relay' in mailertable, otherwise you'll have to define
additional SMTP mailers in your .mc, with different m= fields.

--Per Hedeland
p...@hedeland.org

HRil...@gmail.com

unread,
Dec 7, 2007, 11:46:00 AM12/7/07
to
On Dec 6, 3:52 pm, p...@hedeland.org (Per Hedeland) wrote:
> In article
> <eaf9817b-c700-4169-9bb1-5d5936ccd...@l1g2000hsa.googlegroups.com>

>
> HRiley...@gmail.com writes:
>
> >We need to be able to control the number of messages that get sent in
> >a connection to remote servers. I figure this should be possible by
> >something in the access db, but can't figure out how. Can anyone
> >assist?
>
> Not in access db, but you can use mailertable to choose different
> mailers based on the destination. If you only need one or two values you
> can set SMTP_MAILER_MAXMSGS and/or RELAY_MAILER_MAXMSGS and choose
> 'esmtp' or 'relay' in mailertable, otherwise you'll have to define
> additional SMTP mailers in your .mc, with different m= fields.

Per,

Thanks for the reply. I found this page:

http://www.brandonhutchinson.com/Creating_a_new_sendmail_mailer.html

which is almost what I need. Thinking more about this, I'd like to be
able to implement this based on the recipient MX host, rather than the
recipient. domain. The MX host in question is a third party mail
hosting service and we'd like to be able to implement this without
having to keep track of which recipient domain has that hosting
service.

From the page above, adding the new mailer in the sendmail.mc is
straightforward, but making the change in the mailertable is less so.
Given what I've read so far, it seems like the LHS in the mailertable
is for the recipient address domain, not the recipient MX host domain
and the RHS is for the mailer and the redirected host domain. Is this
correct?

If that's the case, then we have to implement a record in the
mailertable for each recipient address domain, like so:

1.recipient.address.domain
esmtp_mailer_maxmsgs_20:mailhost.service.domain
2.recipient.address.domain
esmtp_mailer_maxmsgs_20:mailhost.service.domain
3.recipient.address.domain
esmtp_mailer_maxmsgs_20:mailhost.service.domain
4.recipient.address.domain
esmtp_mailer_maxmsgs_20:mailhost.service.domain

Is that correct?

Thanks again for the assistance.

Per Hedeland

unread,
Dec 7, 2007, 7:35:04 PM12/7/07
to
In article
<fdebefb5-955d-4080...@y43g2000hsy.googlegroups.com>

HRil...@gmail.com writes:
>On Dec 6, 3:52 pm, p...@hedeland.org (Per Hedeland) wrote:
>> In article
>> <eaf9817b-c700-4169-9bb1-5d5936ccd...@l1g2000hsa.googlegroups.com>
>>
>> HRiley...@gmail.com writes:
>>
>> >We need to be able to control the number of messages that get sent in
>> >a connection to remote servers. I figure this should be possible by
>> >something in the access db, but can't figure out how. Can anyone
>> >assist?
>>
>> Not in access db, but you can use mailertable to choose different
>> mailers based on the destination. If you only need one or two values you
>> can set SMTP_MAILER_MAXMSGS and/or RELAY_MAILER_MAXMSGS and choose
>> 'esmtp' or 'relay' in mailertable, otherwise you'll have to define
>> additional SMTP mailers in your .mc, with different m= fields.
>
>Per,
>
>Thanks for the reply. I found this page:
>
>http://www.brandonhutchinson.com/Creating_a_new_sendmail_mailer.html

This is OK, but as I wrote, if you only need one exception from the
standard "infinity" limit, there's no need to define a mailer in your
.mc - doing it has the drawback that it may get "outdated". I.e. the
contents of cf/mailer/smtp.m4 may change in future releases for whatever
reason, and ideally your copied esmtp should track those changes, but
you'll have to implement that as a manual procedure. Changes of the
magnitude that your mailer will stop working due to incompatibilities
with the rest of sendmail.cf are probably unlikely though.

>From the page above, adding the new mailer in the sendmail.mc is
>straightforward, but making the change in the mailertable is less so.
>Given what I've read so far, it seems like the LHS in the mailertable
>is for the recipient address domain, not the recipient MX host domain
>and the RHS is for the mailer and the redirected host domain. Is this
>correct?

Yes - basically mailertable and MX lookup are different methods to
implement the same thing - the result of the MX lookup will not be
looked up in the mailertable. (The reverse is not true "by default"
though, but you can and probably in general should make it so, by
enclosing the destination host name in mailertable in [brackets] to
prevent the MX lookup.)

>If that's the case, then we have to implement a record in the
>mailertable for each recipient address domain, like so:
>
>1.recipient.address.domain
>esmtp_mailer_maxmsgs_20:mailhost.service.domain
>2.recipient.address.domain
>esmtp_mailer_maxmsgs_20:mailhost.service.domain
>3.recipient.address.domain
>esmtp_mailer_maxmsgs_20:mailhost.service.domain
>4.recipient.address.domain
>esmtp_mailer_maxmsgs_20:mailhost.service.domain
>
>Is that correct?

If you use the mailertable, yes (modulo the line folding that I guess
your posting software did) - but sendmail.cf is a program, it can do
anything.:-) The above is also a maintenance nightmare, how do you track
MX changes for those domains?

With rewrite rules (which can be in your .mc of course), you can do a MX
lookup with the builtin 'bestmx' map, check for the "problem" host(s) in
the MX list, and if found resolve to the appropriate maxmgs-limited
mailer *with the original domain*, to let the sendmail-internal MX code
handle multiple MXen correctly (*that* would actually be quite hard, or
even impossible, to do with rewrite rules).

Completely untested, assuming you only need one "special" mailer, and
hijacking 'relay' for that:

define(`confRELAY_MAILER', `esmtp')
define(`RELAY_MAILER_MAXMSGS', `20')

LOCAL_CONFIG
Kmymx bestmx -z:
C{BadMX} mailhost.service.domain otherhost.example.com

LOCAL_NET_CONFIG
R$* < @ $* . > $: $1 < @ $2. > $| : $(mymx $2 $) :
R$* < @ $* . > $| $* : $={BadMX} : $* $#relay $@ $2. $: $1 < @ $2. >
R$* < @ $* . > $| $* $: $1 < @ $2. >

Note that LHS and RHS of the rules are separated by <TAB>s.

--Per Hedeland
p...@hedeland.org

0 new messages