Setting up email on new host?

RTMc

Registered
Oct 23, 2020
2
0
1
USA
cPanel Access Level
Website Owner
Apologies for this long-winded question, but I'm new to cPanel and want to make sure my question is clear despite my ignorance of proper terminology.

I'm moving my site from it's current host (old-host) to a new hosting service (new-host). There is one domain (old-domain) hosted on old-host. I've currently setup one domain (new-domain) on new-host, but will be moving old-domain over to new-host when everything is ready. There are hundreds of email accounts hosted on old-domain; these are managed by a procmail script that routes each message received into one of a dozen or so folders on a single default email account. I've currently setup equivalent email accounts on new-domain, and figured out how to route them to a similar set of a dozen or so folders on a default email account using cPanel's Global Email Filters. There is a filter corresponding to each email account which examines the TO field of any received email, and if it begins "[email protected]" routes it to the appropriate folder for that "email-acct". Unfortunately, I found that I had to actually create each and every "email-acct" before the Global Email Filter would be applied to emails addressed to that account, even though the message is not stored in "email-acct". In any case, this has all been setup now and appears to be working. My next task is to move old-domain over to new-host and apply the same technique to routing emails received on that domain into the same collection of folders. But, hopefully, not to have to create a whole new set of email accounts and/or filters for old-domain.

I see a couple of cPanel tools that might allow me to do this, given the details of how they work. I'm hoping that some of you experts on cPanel might be kind enough to answer my questions and/or offer advice on how to proceed.

USE EMAIL DOMAIN FORWARDERS
1) If I forward all email for old-domain to new-domain, will I need to setup email accounts for all old-domain addresses? If so, this will require hundreds more email accounts, and is thus not worth it -- I may as well just setup a forwarder for each account.
2) If I do NOT need to setup all the old-domain addresses, will the Email Domain Forwarder leave the beginning of the TO address (up to the @) intact so that the Global Email Filters will route the email to the proper folder?

USE A DOMAIN ALIAS
Same two questions apply... will I need to setup all old-domain addresses for this to work and, if not, will the TO field of the email retain the info needed for the Global Email Filters to route the email to the proper folder?

Any advice or suggestions would be most appreciated! And thanks for suffering through this long winded question.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,297
1,251
313
Houston
I believe you would be fine with a domain forwarder and the answer is in the documentation here: Forwarders | cPanel & WHM Documentation

You absolutely would *not* want the email addresses of the old domain to be present since the documentation states:
Domain forwarders only forward email when the system cannot deliver it to an address or autoresponder. For example, if you create a domain forwarder from the example.com domain to the example1.com domain and someone sends an email to the [email protected] address, the following actions will occur:

 

RTMc

Registered
Oct 23, 2020
2
0
1
USA
cPanel Access Level
Website Owner
I believe you would be fine with a domain forwarder and the answer is in the documentation here: Forwarders | cPanel & WHM Documentation

You absolutely would *not* want the email addresses of the old domain to be present since the documentation states:
Thanks Lauren... that's good news. You wouldn't happen to also have any detailed info regarding my second question, would you? When the Email Domain Forwarder forwards the message, does it leave the TO address alone (at least the beginning part of it up to the @) or does it massage it in any way? Also, are the Global Email Filters then applied to the forwarded message? This will effect whether the message gets stored in the email account (which I don't want to happen) or in the folder on the default email account specified by the filter (which I do want to happen).

Thanks again,
--RT
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,297
1,251
313
Houston
I'm sorry I missed that. it will most definitely keep the first part. I confirmed this on my own test server as well:
I'm forwarding all email to domain1.net ->domain2.wiki
[email protected] does not exist
[email protected] does exist
In the following mail transaction we can see the end result of an email sent from [email protected] is the email is redirected to [email protected]

2020-10-23 17:19:35.915 [26872] 1kW5PH-0006zF-AC => lauren <[email protected]> F=<[email protected]> P=<[email protected]> R=virtual_user T=dovecot_virtual_delivery S=4709 C="250 2.0.0 <[email protected]> eFWONfdWk1/7aAAA9Z/phw Saved" QT=4.599s DT=0.033s