Multiple

-------

Multiple Domain on Server B

If you have multiple websites running on server B, then you need to use different relay host for each domain name. Edit the Postfix main configuration file on server B.

vi /etc/postfix/main.cf

Add the following line in the file, which tells Postfix that we want to use different relayhosts for each sender domain.

sender_dependent_relayhost_maps = hash:/etc/postfix/relay_by_sender

Then create the file.

vi /etc/postfix/relay_by_sender

Add parameters like below. The lefthand side are the sender domains. The righthand side are the hostnames of the mail servers and the port number.

@domain1.com    mail.domain1.com:587 @domain2.com    mail.domain2.com:587

Save and close the file. Then edit the SASL authentication file.

vi /etc/postfix/sasl_passwd

Add login credentials like below.

mail.domain1.com         account@domain1.com:password mail.domain2.com         account@domain2.com:password

Save and close the file. Then create the hash db file.

vi postmap /etc/postfix/relay_by_sender  vi postmap /etc/postfix/sasl_passwd

Restart Postfix SMTP server for the changes to take effect.

vi systemctl restart postfix

From here on out, emails with domain1.com in the Envelope From address will be relayed via mail.domain1.com and emails with domain2.com in the Envelope From address will be relayed via mail.domain2.com. Emails with other domains names in the Envelope From address will be relayed via the host specified for relayhost parameter.

Mail.domain1.com and mail.domain2.com can point to the same IP address, which means the two domain names are using the same mail server.  You can check one of the following tutorials to host multiple domains on a single mail server.

You can also host emails on different servers for the two domain names. If you have multiple WordPress sites on server B, you should also change each functions.php file in your WordPress themes to set custom From address and names for each domain name.

Reload Postfix for the change to take effect.

systemctl reload postfix


-------------- Postfix Transport :  cloud domain -----------


----------Main.cf---------------smtp-gmail_destination_rate_delay = 10ssmtp-gmail_destination_concurrency_limit = 5smtp-gmail_destination_recipient_limit = 10smtp-gmail_initial_destination_concurrency=10smtp-yahoo_initial_destination_concurrency = 1smtp-yahoo_destination_concurrency_limit = 1smtp-yahoo_destination_recipient_limit = 5smtp-yahoo_destination_rate_delay = 20ssmtp-hotmail_destination_rate_delay = 20ssmtp-hotmail_destination_concurrency_limit = 1smtp-hotmail_destination_recipient_limit = 10smtp-hotmail_initial_destination_concurrency=1smtp-aol_destination_rate_delay = 20ssmtp-aol_destination_concurrency_limit = 1smtp-aol_destination_recipient_limit = 10smtp-aol_initial_destination_concurrency=1initial_destination_concurrency = 1default_destination_concurrency_limit = 1default_destination_rate_delay = 6s

----------master.cf---------------
smtp      inet  n       -       n       -       -       smtpd
smtp-gmail unix -    -          n    -          1    smtp       -o syslog_name=custsmtp-gmailsmtp-yahoo unix -    -          n    -          1    smtp       -o syslog_name=smtp-yahoosmtp-hotmail unix -  -          n    -          1    smtp       -o syslog_name=smtp-hotmailsmtp-aol     unix -  -          n    -          1    smtp       -o syslog_name=smtp-aolsmtp-outlook unix -  -          n    -          1    smtp       -o syslog_name=smtp-outlooksmtp-live unix -  -          n    -          1    smtp       -o syslog_name=smtp-livesmtp-msn unix -  -          n    -          1    smtp       -o syslog_name=smtp-msn
submission inet n       -       n       -       -       smtpd
------Transport------------
gmail.com smtp-gmail:[202.4.96.36]yahoo.com smtp-yahoo:[202.4.96.36]hotmail.com smtp-hotmail:aol.com smtp-aol:outlook.com smtp-outlook:live.com smtp-live:msn.com msn.com:
               ---------/etc/postfix/transport  /\@gmail\.com$/       smtp-gmail:/yahoo(\.[a-z]{2,3}){1,2}$/  yahoo:/\@hotmail\.com$/ hotmail:/\@live\.com$/ hotmail:/\@msn\.com$/ hostmail:/\@windowslive\.com$/ hotmail:

---------------
















-------