Part 5. Mail traffic routing. Authorization on a upstream server.

The list of articles cycle

Typically, you do not need to configure mail traffic routing. All messages will be routed automatically, according to MX records in the DNS of the recipient domain. But there are exceptions to this rule. Using the transport_maps option, you can explicitly specify the server to which the mail will be sent for the specific domain.

Let’s create file /etc/postfix/transport and insert into it the line:

test.local smtp:192.168.0.2

 

Let’s create an indexed map from this file:

postmap /etc/postfix/transport

 

Next, add a line to the main.cf file:

transport_maps = hash:/etc/postfix/transport

 

Let’s restart Postfix

service postfix restart

 

Now, all messages for users in the test.local domain will be sent to the server 192.168.0.2 and it will happen without any requests from the mail server.

 

Another reason is to configure routing is when the mail can not be sent directly to the recipient's server for some reason. In this case, you must use a higher-level server-the so-called mail relay.

This can be accomplished using the parameter relayhost.Assume that we need to send mail through a server named mail.test.local and through port 587 (SMTP submission port). To achieve this, add a line to the main.cf file:

relayhost = [mail.test.local]:587

 

After Postfix restart all messages will be routed to the mail.test.local.

There may be another problem at this stage. This will happen if the relay server requires authorization. To cjnfigure the login-password transmission you must do the following

Insert the following lines into the file main.cf :

 

# Enable Authentification

smtp_sasl_auth_enable = yes

# Specify a file with logins and passwords

smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd

#Disable anonymous authentication

smtp_sasl_security_options = noanonymous

 

Let’s create file /etc/postfix/sasl_passwd and insert to it:

mail.test.local user@test.local:password

where

mail.test.local is the server to on which we will log in

user@test.local:password Login:Password

 

Then execute the command:

 

postmap /etc/postfix/sasl_passwd

 

and restart Postfix

service postfix restart

 

The list of articles cycle

You can buy the book

"Mail server based on Postfix,

Dovecot and RoundCube"

in electronic form in the store

ХinХii