[Techtalk] Sendmail selective relaying solution

subhasis Gupta subhasis at utiisl.co.in
Wed Dec 17 15:21:33 EST 2003

Hi All,
Based on a posting of:Didar Hussain (URL: http://www.linuxchix.org/pipermail/techtalk/2002-June/011407.html) I was able to provide selective relaying to my users. 
When the unlisted users are sending mails to outside domains, their mails are not relayed. However, there is no error message that is getting sent to those users. Can someone please help?
My complete setup details is given below:
I have a mail server with RHL 9 and sendmail-8.12.8-4.I have installed sendmail and sendmail-cf using rpm. I want some users on the list to be able to send mails to outside world while I want to retrict some of them from sending. 
I have put the following part in my sendmail.mc and used generated sendmail.cf:
<!-- CODE STARTS HERE // -->
# This ruleset checks the recipient address
# This ruleset receives the address in the SMTP RCPTTO command
# First off, parse the address by sending it to ruleset 3
R$*                             $: $>3 $1
# If the address is to anyone in "ourdomain.com", then allow it through and don't do further checking
R$+ < @ mail..mydomain.com . >           $@ OK
# If it is not, then we check the sender address
# We replace the LHS with the sender (MAIL FROM)address stored in the "$&f" MACRO and send it to ruleset 3 for parsing
R$+ < @ $+ >                    $: $>3 $&f
# If the sender is in CLASS {LetRelay}, then he is allowed to relay
R$={LetRelay} < @ mail.utiisl.co.in . > $@ OK
# If he is not in the class, the he gets an error
R$*                             $#error $@ UNAVAILABLE $: We don't like you sending mail outside this domain
<!-- CODE ENDS HERE // -->
When I login using an account in relayble file, I am able to send mails to outside world. 
However, when I send a mail from my Outlook Express (from an account not listed in the relayble file), it does not show any error. The mail is not going outside, ie my purpose is served, but no error message is thrown. The maillog file shows the error. 
I have started sendmail daemon using command: 
sendmail -bd -q1

WHat should be done so that the error is displayed in Outlook Express or at least a return mail is sent to the sender with the messages in the maillog file?

All I want is a few minutes alone with the source code for the universe and a quick recompile. 
     /     \     
     \. at -@./     Subhasis Gupta
     /`\_/`\     Manager - Deptt. of IT 
    //  _  \\    UTI Investor Services Limited
   | \     )|_   Pl 3, Sector # 11, UTI Bhavan
  /`\_`>  <_/ \  CBD Belapur, Navi Mumbai - 400 614
  \__/'---'\__/  mailto:subhasis at utiisl.co.in;subhasis.gupta at uti.co.in
		 Visit us at http://www.utiisl.co.in
		 Phone : +91 22 27561690 Extn 2108

More information about the Techtalk mailing list