Send email over smarthost, wich ist a "local" Domain and must be send over smarthost


i need help hwo to konfigure postfix oder UCS to send several emails to a user that dos’n exists on the lokal server but has the same local domain (in this case a daughter that should not have acces to the local server but the email contact must be functional)

How could i make this?

Thanks for Help :wink:


in such a setup postfix things that it is the final destination for all local addresses in the domain the-affected.domain. In order to make postfix accept and forward mail for an account in that domain that doesn’t exist in the local LDAP database, there are two things to configure:

  1. You’ll have to tell postfix that the account external-account@the-affected.domain exists. Otherwise postfix won’t accept mail for that account at all.
  2. You’ll have to tell postfix where to send mail for that account to.

For the first we usually use the virtual_mailbox_maps functionality. It configures maps postfix does a lookup on when new mail arrives. The important part is that the recipient’s address (in our example: external-account@the-affected.domain) exists in the map, whereas the resulting value is ignored.

For the second we use the transport_maps functionality. When deciding what to do with an accepted mail postfix does a lookup on the maps configured here. If a match is found in one of the maps, the resulting value is used as the next hop destination. So a simple entry such as external-account@the-affected.domain smtp:external.stmp.server would tell postfix to forward mail via a specific mail server.

As both mechanisms require a map and look up the same value, we can actually use the same map file for both. Create a file, e.g. /etc/postfix/external_accounts_transport, with the content similar to the following (substitute your actual values, of course):

external-account@the-affected.domain  smtp:external.stmp.server

Then hash the file by running postmap /etc/postfix/external_accounts_transport.

Next you’ll have to configure the Univention template mechanism that creates and maintains /etc/postfix/ to use that file, too. Fortunately this is as easy as setting to UCR variables:

CURRENT_VALUE="$(ucr get mail/postfix/virtual/mailbox/maps)"
ucr set mail/postfix/virtual/mailbox/maps="${CURRENT_VALUE:-ldap:/etc/postfix/ldap.virtual_mailbox, ldap:/etc/postfix/ldap.sharedfolderlocal} hash:/etc/postfix/external_accounts_transport"

CURRENT_VALUE="$(ucr get mail/postfix/maps/transport)"
ucr set mail/postfix/maps/transport="${CURRENT_VALUE:-hash:/etc/postfix/transport} hash:/etc/postfix/external_accounts_transport"

Finally reload postfix’s configuration: postfix reload

And you should be done.

Kind regards,