0

I'm using sendmail 8.14.4 on x64 Centos 6.3. and have followed the instructions provided by adamo in: How can I configure sendmail (or another mail server) to accept outbound mail, but to not send it out? to send all mails to a specific mailbox as follows:

LOCAL_RULE_0
R$* < @ $=w . > $*              $#local $: $1 
R$* < @ $* . > $*               $#local $: quicksilver

This compiles with M4 just fine and deposits the rules in the .cf file with another that seems to be there by default.

Unfortunately sendmail does not send messages to the designated mailbox.

If I run

sendmail -d21.12 q@q.com 

the debug output shows that it's running Parse0 but then it's skipping ParseLocal (98) as follows:

... 
rewrite: ruleset Parse0           returns: q < @ q . com . >
rewritten as: q < @ q . com . >
-----trying rule: < @ >
----- rule fails
-----trying rule: $*
-----rule matches: $: $> ParseLocal $1
-----skip subr ParseLocal (98)
rewritten as: q < @ q . com . >
-----trying rule: $*
-----rule matches: $: $> Parse1 $1
rewrite: ruleset Parse1             input: q < @ q . com . >
...

A test e-mail:

echo 'this is a test'| mail -s test_email q@q.com

sends directly to q@q.com

sendmail -bt
0 q@q.com

translates to q@q.com (does not translate) but strangely

sendmail -bt
3,0 q@q.com

does translate to quicksilver

So at this point my best guess is that sendmail is either not canonifying first when sending mails or that sendmail is somehow set to not run local rules after Ruleset 0.

Any thoughts on why addresses are not being translated?

2 Answers2

1

Ok... I seem to have found the problem... or at least resolved it anyway.

I noticed when checking for the maillog that after deleting (to get a fresh start) and restarting sendmail the maillog did not reappear. I gave the machine a reboot just to reset everything and now it works.

I was definitely restarting the service each time using "service sendmail restart" but now that I think of it occasionally it would indicate that stopping the service failed. I suppose that it's possible that the service never really stopped properly and so that each time I restarted it was either failing to start but reporting OK because it was already running or that it was running a second instance. That does not really explain why "sendmail -bt" did a translation unless perhaps, when debugging, it loads a separate copy of the configuration into a private context.

Just in case someone else happens across this thread a fellow in the comp.mail.sendmail group suggested a slightly different approach as follows:

He said that catching all email to non local addresses can be done using SMART_HOST.

define(`SMART_HOST',`local:quicksilver')dnl

will redirect to the local account. I've checked the docs and it looks like another good way to solve the problem.

0

I have found that debugging sendmail files is tricky. The problem being that when you call sendmail as you did in your initial attempt, what it is doing is not doing the delivery at all, what it is doing is only running the submit phase of sendmail (represented usually by submit.cf) and not the full sendmail.cf file you think it is.

I can't remember is 0,3 or 3,0 is the best way to check things out try both.

I'm pretty sure your local ruleset is being applied, just not at submit time.

mdpc
  • 11,698
  • 28
  • 51
  • 65
  • 3,0 works but 0,3 doesn't. I guess the rule assumes that the address has already been canonified and the order determines how the rules are run. I completely agree that it looks like something is preventing the local rules from being run for real mails... I'm still pouring through the docs. – Quicksilver Feb 14 '13 at 20:39
  • You have to call rule set 3 before anything, for the automatically generated rule sets always assume a canonified address. – adamo Feb 15 '13 at 06:29