Web linux-server.50webs.com

Linux Mail Server

Testing How Addresses Are Rewritten (Part 2):

Next, run sendmail -bt with the -C option to use the newly created test.cf configuration file. The –C option permits you to specify the sendmail configuration file on the command line. the following listing shows this test.


# sendmail -bt -Ctest.cf
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> /tryflags HS
> /try smtp craig
Trying header sender address craig for mailer esmtp
canonify input: craig  
Canonify2 input: craig  
Canonify2 returns: craig  
canonify returns: craig  
1 input: craig  
1 returns: craig  
HdrFromSMTP input: craig  
PseudoToReal input: craig  
PseudoToReal returns: craig  
MasqSMTP input: craig  
MasqSMTP returns: craig < @ *LOCAL* >
MasqHdr input: craig < @ *LOCAL* >
MasqHdr returns: craig < @ parrot . foobirds . org . >
HdrFromSMTP returns: craig < @ parrot . foobirds . org . >
final input: craig < @ parrot . foobirds . org . >
final returns: craig @ parrot . foobirds . org
Rcode = 0, addr = craig@foobirds.org
> /quit

Running sendmail –bt –Ctest.cf starts sendmail in test mode, and tells it to use the new configuration that is stored in test.cf. The test in the previous listing shows that the value entered in the M macro is used to rewrite the sender address in the message header. You know this because the address returned from ruleset final is now craig@foobirds.org, which is just what you want.

Run additional tests (for example, /try esmtp kathy@robin.foobirds.org) to see if client addresses are rewritten correctly. When you're confident that the configuration is correct and reliable, move the test.cf configuration file to sendmail.cf to make the new configuration available to sendmail.

If you are called upon to help someone configure sendmail on a system that doesn't already have the m4 source file installed, it may be easier to directly edit the sendmail.cf file, but only if the change is very small. If you can avoid it, don't make changes directly to the sendmail.cf file. If you really want to make major sendmail configuration changes, use m4 to build your configuration.

.