Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.programmer > #1050
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Rainer Weikusat <rweikusat@mssgmbh.com> |
| Newsgroups | comp.unix.programmer |
| Subject | Make sendmail read the SMART_HOST from a file |
| Date | Tue, 02 Aug 2011 13:47:10 +0100 |
| Lines | 53 |
| Message-ID | <87fwlkhtf5.fsf@sapphire.mobileactivedefense.com> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | individual.net IuXvHgBIk0HKROuT45D/4w6GFv0p/t5h8SiMDK0WJdNGsgDiI= |
| Cancel-Lock | sha1:PKzb0w0HLSWokhUuwGGMViBr4tM= sha1:cC86x1yghN/moPMXdORwWXKNSuc= |
| User-Agent | Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
| Xref | x330-a1.tempe.blueboxinc.net comp.unix.programmer:1050 |
Show key headers only | View raw
NB: This is a 'I need something which works and it needs to be a text file with a simple format' solution. I don't claim that it is particularly elegant or that better solutions to the same problem are not available. In order to facilitate setting the value mentioned in the Subject: from a web less-than-masterfully programmed web interface, I needed to change a 'stock' Debian sendmail configuration such that it reads that from a file. This can be done by creating a text file with the following (example) content (assumed to be /etc/mail/smart-host): 0 relay.example.com Then, a suitable text map needs to be defined in sendmail.cf (going via any route you're comfortable with) Ksmart_host text -v1 -k0 /etc/mail/smart-host Then, a ruleset needs to be defined in order to use this map. This ruleset is supposed to be called from the Parse1 ruleset instead of just expanding $S: Ssmart_host R$+ $: $(smart_host 0$) $1 Lastly, the two lines using $S need to be changed as follows: R$* < @ [ $+ ] > $* $: $1 < @ [ $2 ] : $>smart_host > $3 Add smart host to path and R$* < @ $* > $* $: $>MailerToTriple < $>smart_host > $1 < @ $2 > $3 glue on smarthost name This will reread and reparse the smart host file every time the corresponding ruleset is invoked. It is actually possible to just set the S macro to the corresponding value and use that (I've just retyped this out of my head) by first defining a 'macro' map: Kset macro and then using a smart_host ruleset which looks like this (based on the assumption that no two consecutive dots will be in the argument): Ssmart_host R$+ $: $1 . . $&S append value of S R$+ . . $+ $@ $2 $1 has a value? => done R$+ . . $1 . . $(smart_host 0$) append result of lookup R$+ . . $+ $(set S $@ $2 $) $2 $1 set S to that, return (intended to be used in the same place). I you feel inclined to post a 'my MTA is longer than your MTA' reply, please skip that.
Back to comp.unix.programmer | Previous | Next | Find similar | Unroll thread
Make sendmail read the SMART_HOST from a file Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-08-02 13:47 +0100
csiph-web