0

I need to achieve following functionality:

User send email to example@example1.com that now is not existing email. I buy this domain (example1.com) and would like auto redirect all emails that incoming into example@example1.com to example@example2.com which belongs for other company. Domain example1.com will be used only for this email alias.

I have VPS server with Ubuntu, nginx installed, for example, with ip 80.70.60.50.

How I can configure that functionality? What type of dns records I should select?

1 Answers1

0

Two options actually:


  • When you have control over the example2.com mail server(s):
    in most mail server software you can add an alias domain such that for any existing mailbox@example2.com mailbox the corresponding email address mailbox@example.1.com will also get accepted and delivered there.

You will need to look up existing MX DNS records for example.2.com for instance with dig MX example.2.com and set the same one(s) for the example.1.com domain. That would result in something like

example1.com.      IN MX 5  smtp.example2.com.
example1.com.      IN MX 10 relay.example2.com.

And then configure those existing mail server ([smtp | relay].example2.com.) to accept mail for the new alias domain.


  • When you don't have control over the example2.com mail server(s):
    You will need to run on your VPS your own SMTP server (for instance postfix, exim, sendmail) that will accept mail for @example1.com and for each email address forward the message to the corresponding email address @example2.com.

You will need to create DNS MX records to deliver incoming email for @example1.com to your VPS:

example1.com.      IN MX 5  smtp.example1.com.
smtp.example1.com. IN A     <ip-address of your VPS>

And then set up for instance with postfix: How to redirect all mail from one domain to another in Postfix?

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • Thank you for your answer, but in DNS control panel i cannot attach MX record to domain, there are only ip address field accepted. – Aleksandr Nov 06 '17 at 15:19