# sendmail msp (submit.cf) + aliases



## kuyaedz (May 23, 2010)

I've been trying to configure my Jails to use sendmail msp to deliver directly to my mail server. The goal is to not bind sendmail to an IP/port, but simply connect to the msp and deliver directly.

The issue I'm having is that this configuration doesn't honor the /etc/aliases, /etc/mail/generics or any other solution I've tried. I need to make sure that email to root, when delivered at the msp, is forwarded/delivered to the proper user (mine).

Can anyone tell me how I can use msp + aliasing/forwarding/masquerading/etc so that mail to root@jail.domain.tld actually gets delivered to user@validdomain.tld


----------



## crsd (May 23, 2010)

Did you run newaliases(1) after changing /etc/aliases?


----------



## elb (Dec 16, 2010)

I know this is an old thread, but I came across it in my search for a solution to the same problem.  So I thought I'd document how I solved it, which may or may not be useful for someone else.

In my case, my jails have hostnames with a fictitious domain such as "jailed" (e.g., http://www.jailed, ns.jailed, etc).  I run postfix in one of the jails (mail.jailed), with sendmail msp on the rest of them configured via submit.cf to hand mail off to mail.jailed

The problem was that sendmail msp would append the full hostname to unqualified names (e.g, "root" becomes "root@www.jailed") before handing it off.  Sendmail msp also completely ignores aliases (apparently this is intentional).  Postfix would then dutifully try to relay the mail back to http://www.jailed, which of course isn't listening.

I played with LOCAL_RELAY, sticky, and MAIL_HUB definitions in the submit.cf, which sendmail happily and consistently ignored.

I solved it on the postfix side instead by creating a recipient_canonical_maps pcre containing:

```
/^(.*)\@.*\.jailed/      $1
```
This takes whatever is in front of the @ and makes it the new address.  For example, "root@www.jailed" becomes simply "root".  This is then processed by postfix's aliases.  You could just as easily do:

```
/^(.*)\@.*\.jailed/      $1@example.com
```
or

```
/^fred\@.*\.jailed/      fred@example.com
```

I did solve the issue another way first:  by listing every jail in "mydestinations".  I didn't like that solution because it meant I had to update mydestinations every time I added a jail.  The above solution is automagic for whatever jails I'm running.


----------

