Plesk Postfix Domain Based Smarthost
In many situations a client needs to redirect all his mail to another SMTP server and you have the need to convert your Plesk Server for this domain to “SMTP Transport Mode“.
This is usefull for example, when a client has a hosting server or is hosted in a multidomain environment and wants to redirect all the mail received to his corporate mail server, like a Microsoft Exchange Server.
There is very few documentation about this in Parallels Forums and I know that can be a little bit scary to modify the Plesk Postfix Configuration Files. Don’t worry, this is what you have to do in five easy steps.
- Edit the file /etc/postfix/main.cf and if no set add the next two lines. In the first case, is allways defined, you have to add the last “hash”.
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual, hash:/etc/postfix/virtual_mailbox_maps
transport_maps = hash:/etc/postfix/transport
- Create the transport file in /etc/postfix as defined before with this content. NOTE: example.com is the domain you want to transport mail to another SMTP.
example.org smtp:[IP_or_Hosname]
- Create the virtual_mailbox_maps file with this content, this is done to maps all the email addresses to the end server:
@example.com @example.com
- Make a postmap of both files, transport and virtual_mailbox_maps to make it Postfix readable
- Restart Postfix daemon “et voilá”
I hope this configuration will be helpfull to you. In this case leave a comment.
Dear friends, I have a VPS with multiple domains hosted. Over time I was a problem with shipping to accounts ‘hotmail.com’. The solution I found was to hire an SMTP service to relay e. I had to configure Postfix to have some authentication data for each domain. Here attached configuration for which you can serve:
/etc/postfix/main.cf
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwords
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
start_tls = yes
header_size_limit = 4096000
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
relayhost =
/etc/postfix/sender_relay
@dominio.com [smtp.servidorsmtp.com]:25
/etc/postfix/sasl_passwords
#[smtp.servidorsmtp.com]:25 usuario:clave
@dominio.com usuario:clave
postmap /etc/postfix/sender_relay
postmap hash:/etc/postfix/sasl_passwords
/etc/init.d/postfix restart
This configuration works well for the relay of all emails in each domain. My question now is whether there is a Postfix configuration allowing the relay emails sent only to ‘hotmail.com’ for each domain. That would solve my problem, because the only emails I am having reception problems are with ‘hotmail.com’, others are working properly and I can send to my VPS server.
Thank you very much in advance.
David Perez
February 5, 2013 at 09:02
Thanks for your helpfull post.
My scenario is a litte more complicated. Do You have an idea, how it is possible to pipe the mails through a virus filter BEFORE redirecting them to the corporate mailserver?
Thank you very much in advance!
Volker
January 18, 2014 at 23:03
Thank you very much!!
one ppoint to add:
in main.cf add the domain to mydestination, so you dont get a relay access denied
Daniel Meier
May 22, 2014 at 07:57
It’s enormous that you are getting thoughts from
this paragraph as well as from our discussion made at this place.
neck problems
November 25, 2014 at 07:38