HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - HP-UX
 - >
 - sendmail and relaying question
 
Operating System - HP-UX
        1840126
        Members
    
    
        5066
        Online
    
    
        110161
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
 - Entry Storage Systems
 - Legacy
 - Midrange and Enterprise Storage
 - Storage Networking
 - HPE Nimble Storage
 
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
 - Appliance Servers
 - Alpha Servers
 - BackOffice Products
 - Internet Products
 - HPE 9000 and HPE e3000 Servers
 - Networking
 - Netservers
 - Secure OS Software for Linux
 - Server Management (Insight Manager 7)
 - Windows Server 2003
 - Operating System - Tru64 Unix
 - ProLiant Deployment and Provisioning
 - Linux-Based Community / Regional
 - Microsoft System Center Integration
 
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
	
		
			
            
                
            Go to solution
        
            
		
		
			
            	
	
		
        
		
	
	
		Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
 - Mark Topic as New
 - Mark Topic as Read
 - Float this Topic for Current User
 - Bookmark
 - Subscribe
 - Printer Friendly Page
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
05-30-2002 05:04 PM
05-30-2002 05:04 PM
			
				
					
					
						I have a problem, and I'm not sure if I'm reading the docs properly.
I have sendmail running with DS set to our internal mail server. This is cool, if I email "root" it sends it on to our exchange server than on to me.
Is there a way to set sendmail up so that it performs relaying based on the email address?
For example:
mailx -s "foo.com test" foo@foo.com goes via the foo.com relay.
mailx -s "company.org" me@company.org goes via the relay company.org
Is it possible to relay dependant on the email address?
Any help appreciated.
	
			
				
		
			
			
			
			
			
			
		
		
		
	
	
	
I have sendmail running with DS set to our internal mail server. This is cool, if I email "root" it sends it on to our exchange server than on to me.
Is there a way to set sendmail up so that it performs relaying based on the email address?
For example:
mailx -s "foo.com test" foo@foo.com goes via the foo.com relay.
mailx -s "company.org" me@company.org goes via the relay company.org
Is it possible to relay dependant on the email address?
Any help appreciated.
Solved! Go to Solution.
		3 REPLIES 3
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
05-31-2002 07:03 AM
05-31-2002 07:03 AM
Solution
			
				
					
					
						Yes, this is possible but it is a bit tricky:
Here is what I do (in sendmail.cf):
Create a new macro for another relay. I will define a 'T' macro for this. The 'S' macro will be used for everything except
To make things clearer, I will define the 'M' (masqurade) macro.
-----------------------------
# who I masquerade as
DMchemfirst.com
# "Smart" relay host (may be null)
DSelmer
# Relay for local domain
DTcemgw1
------------------------------------
My plan is for everything that is NOT xxx@chemfirst.com to be sent via the 'S' (host elmer) relay; anything that is xxx@chemfirst will be sent via the 'T' (host cemgw1) relay.
Now down in the section of sendmail.cd just before 'S' ($S) macro is used; I make the following changes using instead the 'T' ($T) macro instead if I detect a local domain address. (I have also added a few rules if other related domains are found; they too use the 'T' relay. ekctech.com, firstchem.com, cfem.com)
Finally, if no local domains are detected we fall through to the 'normal' 'S' smart relay.
---------------------------------------
# pass names that have local domain to relay host $T
# 03/05/02 added ekctech, firstchem, cfem to relay $T
R$* < @ $m > $* $: $>95 < $T > $1 < @ $m > $2
R$* < @ ekctech.com > $* $: $>95 < $T > $1 < @ ekctech.com > $2
R$* < @ firstchem.com > $* $: $>95 < $T > $1 < @ firstchem.com > $2
R$* < @ cfem.com > $* $: $>95 < $T > $1 < @ cfem.com > $2
# pass names that still have a host to a smarthost (if defined)
R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
---------------------------------------------
If all of this looks very strange to you (and it should), I suggest that you purchase a copy of O'reilly's 'Sendmail'. That book will turn what is opaque to merely murky.
Regards, Clay
					
				
			
			
				
		
		
	
	
	
Here is what I do (in sendmail.cf):
Create a new macro for another relay. I will define a 'T' macro for this. The 'S' macro will be used for everything except
To make things clearer, I will define the 'M' (masqurade) macro.
-----------------------------
# who I masquerade as
DMchemfirst.com
# "Smart" relay host (may be null)
DSelmer
# Relay for local domain
DTcemgw1
------------------------------------
My plan is for everything that is NOT xxx@chemfirst.com to be sent via the 'S' (host elmer) relay; anything that is xxx@chemfirst will be sent via the 'T' (host cemgw1) relay.
Now down in the section of sendmail.cd just before 'S' ($S) macro is used; I make the following changes using instead the 'T' ($T) macro instead if I detect a local domain address. (I have also added a few rules if other related domains are found; they too use the 'T' relay. ekctech.com, firstchem.com, cfem.com)
Finally, if no local domains are detected we fall through to the 'normal' 'S' smart relay.
---------------------------------------
# pass names that have local domain to relay host $T
# 03/05/02 added ekctech, firstchem, cfem to relay $T
R$* < @ $m > $* $: $>95 < $T > $1 < @ $m > $2
R$* < @ ekctech.com > $* $: $>95 < $T > $1 < @ ekctech.com > $2
R$* < @ firstchem.com > $* $: $>95 < $T > $1 < @ firstchem.com > $2
R$* < @ cfem.com > $* $: $>95 < $T > $1 < @ cfem.com > $2
# pass names that still have a host to a smarthost (if defined)
R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
---------------------------------------------
If all of this looks very strange to you (and it should), I suggest that you purchase a copy of O'reilly's 'Sendmail'. That book will turn what is opaque to merely murky.
Regards, Clay
	If it ain't broke, I can fix that.
			
			
				
			
			
			
			
			
			
		- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
05-31-2002 09:48 AM
05-31-2002 09:48 AM
			
				
					
						
							Re: sendmail and relaying question
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						>Is it possible to relay dependant on the email address? 
Yes - see mailertable [used to override/coerce mail routing by domain]
Format is like
domain.com smtp:nameof.your.host.com
and
virtusertable which will work on a user by user basis for inbound mail
Format is like
a@domain.com a@newplace.com
b@domain.com b@otherplace.com
c@otherdomain.com d@someplace.com
and
genericstable [like virtusertable for outbound mail
a@a.b.com a@a.com
Uncomment
either the virtusertable entries in sendmail.cf and/or mailterable entries in sendmail.cf and/or genericstable entries in sendmail.cf:
virtusertable:
# Virtual user table (maps incoming users)
Kvirtuser dbm /etc/mail/virtusertable
mailertable
# Mailer table (overriding domains)
Kmailertable dbm /etc/mail/mailertable
genericstable
# Generics table (mapping outgoing addresses)
Kgenerics dbm /etc/mail/genericstable
{Note for each feature, search for the feature {genericstable/mailertable/virtusertable} and make sure all of the supporting rulesets are uncommented (I'll include one for example:)
... Uncomment these rules ...
S90
#R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
#R$* <$~[ : $+ > $* $>95 < $2 : $3 > $4 check -- resolved?
#R$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again
#R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "."
#R< $~[ : $+ > $* $>95 < $1 : $2 > $3 "." found?
#R< $* > $* $@ $2 no mailertable match
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
Yes - see mailertable [used to override/coerce mail routing by domain]
Format is like
domain.com smtp:nameof.your.host.com
and
virtusertable which will work on a user by user basis for inbound mail
Format is like
a@domain.com a@newplace.com
b@domain.com b@otherplace.com
c@otherdomain.com d@someplace.com
and
genericstable [like virtusertable for outbound mail
a@a.b.com a@a.com
Uncomment
either the virtusertable entries in sendmail.cf and/or mailterable entries in sendmail.cf and/or genericstable entries in sendmail.cf:
virtusertable:
# Virtual user table (maps incoming users)
Kvirtuser dbm /etc/mail/virtusertable
mailertable
# Mailer table (overriding domains)
Kmailertable dbm /etc/mail/mailertable
genericstable
# Generics table (mapping outgoing addresses)
Kgenerics dbm /etc/mail/genericstable
{Note for each feature, search for the feature {genericstable/mailertable/virtusertable} and make sure all of the supporting rulesets are uncommented (I'll include one for example:)
... Uncomment these rules ...
S90
#R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
#R$* <$~[ : $+ > $* $>95 < $2 : $3 > $4 check -- resolved?
#R$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again
#R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "."
#R< $~[ : $+ > $* $>95 < $1 : $2 > $3 "." found?
#R< $* > $* $@ $2 no mailertable match
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-03-2002 01:37 PM
06-03-2002 01:37 PM
			
				
					
						
							Re: sendmail and relaying question
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						It doesn't look that strange clay, my mind just went blank and I didn't have the book at work. :)
What you describe makes a lot of sense.
Thanks for the help.
Scott.
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
What you describe makes a lot of sense.
Thanks for the help.
Scott.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP