# [sendmail] Masquerading



## fonz (Feb 18, 2009)

Howdy,

A quick sendmail question:
When using
	
	



```
define(`SMART_HOST', `smtp.my-isp.org')
```
in sendmail.mc, how does one instruct sendmail to masquerade all outgoing mail from anyuser@localnonexistentdomain.com to remoteuser@my-isp.org?

Thanks in advance,

Alphons


----------



## DutchDaemon (Feb 18, 2009)

See "MASQUERADING AND RELAYING" in /usr/src/contrib/sendmail/cf/README


----------



## fonz (Feb 18, 2009)

DutchDaemon said:
			
		

> See "MASQUERADING AND RELAYING" in /usr/src/contrib/sendmail/cf/README


That only discusses masquerading as a domain, which leads to _localuser@localdomain_ being masqueraded as _localuser@remotedomain_. I need it to be _*remote*user@remotedomain_.

I've added the following to sendmail.mc:
	
	



```
define(`SMART_HOST', `smtp.remotehost.nl')

FEATURE(local_no_masquerade)
FEATURE(masquerade_envelope)
FEATURE(genericstable,DATABASE_MAP_TYPE` -o 'MAIL_SETTINGS_DIR`genericstable')
GENERICS_DOMAIN(`localhost')
GENERICS_DOMAIN(`hostname.localdomain.nl')
```
and /etc/mail/genericstable contains:
	
	



```
@localhost remoteuser@remotedomain.nl
@hostname.localdomain.nl remoteuser@remotedomain.nl
```
but still no joy: outgoing mail is shown as localuser@hostname.localdomain.nl.

Alphons


----------



## DutchDaemon (Feb 18, 2009)

You may try userdb. You will have to define every single local user for that to work, but I guess we're not talking hundreds here?

Example: 
http://forums.serverbeach.com/archive/index.php/t-1438.html
http://cri.ch/linux/docs/sk0009.html

Or google for 'sendmail userdb'


----------



## fonz (Feb 19, 2009)

DutchDaemon said:
			
		

> You may try userdb. You will have to define every single local user for that to work, but I guess we're not talking hundreds here?


Nah, only a few.

Anyway: according to this link:
	
	



```
# NOTE: Combined with virtusertable and/or aliases, Genericstable
#       can do everything the userdb can and more (and the difference
#       is growing bigger). The userdb is basically obsolete.
```
Now, primo: I don't know how much of that is true. And secundo: as long as it works, what do I care?

Unfortunately, I couldn't get userdb to work either. However, I found this little HOWTO: http://www.lege.com/Sendmail+Dialup.v1.00-5.html. And guess what: it works now!

Anyway, thanks for the help!

Alphons

Edit: Note to add: I could write a little guide on this in the HOWTO forum, unless you guys think it's too trivial.


----------

