Point 2nd domain name to existing site whilst retaining email accounts - email

I tried searching on SO but all answers seem to involve .htaccess and 301 redirects. I am wondering if there is a way to do this just using cpanel and the DNS providers interface.
Simply I own two domain names: mysite.com and thissite.com
Both are currently pointing to servers and both have email addresses associated with them.
I want to point thissite.com to mysite.com without disrupting the email addresses already associated with thissite.com
At first I changed the nameservers of thissite.com to be the same as mysite.com but this disrupted the emails so I quickly changed them back.
I then changed the A record of thissite.com to point to the IP address of mysite.com. The same issue seems to have occurred though - the email addresses are still broken.
Can anyone point me in the right direction here? Thanks

Normally A records are not related to emails. Possibly your email problems caused by DNS still cached since your first experiment.
DNS stores a destination SMTP server where email for the domain in an MX-type record. See what MX record you have for thissite.com.
nslookup
set type=mx
thissite.com
If your domain have correct MX records, then the A record do not matter for emails.

Related

Forwarding emails when using Google Domains and Cloudflare [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
I have recently acquired a domain name via Google Domains. I have set some configuration to have it point at an OpenShift application via Cloudflare. Cloudflare requires me to set their DNS servers, which I did in Google Domain.
At Cloudflare, I have created two CNAME records (and nothing else). One is an alias from my mydomain.com to some.url.at.openfshit.com, and the other is from www to mydomain.com.
Yet, within Gmail Domain, I have also set an email using my domain name which is to be forwarded to a private email. But, I don't receive any emails when testing.
I am wondering whether I could have my emails forwarded properly. Is it a matter of creating a MX record at Cloudflare? If yes, with what configuration?
P.S.: I have set a MX record using instructions available here, but I get:
Delivery to the following recipient failed permanently:
contact#mydomain.com
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain chartvibes.com by aspmx.l.google.com. [2607:f8b0:4001:c20::1b].
The error that the other server returned was:
550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 https://support.google.com/mail/answer/6596 p123si522326ioe.111 - gsmtp
The MX records you're using are for G Suite accounts. You can still forward emails with Cloudflare and Google Domains, but you'll need different MX records. As Overdrivr pointed out in a comment below, you can find your MX records in the DNS settings in Google Domains. Once you're in the DNS settings page, look for a collapsible panel called "Email forward" under the "Synthetic records" section. You should see something like this
Then, make a backup of your Cloudflare DNS setup, erase all MX records and add the ones listed in your account using the number right before the mail server (e.g., 5, 10, etc.) as its priority.
It might take a few minutes for the changes to take effect. If you try to send an email right after changing the records, it's likely that you'll get a message saying that the address could not be found, but it'll have the G Suite mail server in the Remote-MTA field (aspmx.l.google.com) instead of gmr-smtp-in.l.google.com. If this is the case, just wait for a few more minutes and try again
I'm not sure if you already have a solution to this, but if you do, I'm interested in how to do it too. Could you please post your solution here if you find one ?
The bad news is, it cannot be done because the way Google Domains work. Google Domains has email forwarding, but it works only when you're using Google's DNS servers. It's the same with all hosting services or whatever they're called.
I think Google just has an email forwarding service that can forward upto 100 alias email addresses per domain to an actual email address. But the actual email address has to exist somewhere. The ones you set up in the Domains console are just aliases or forwarding instructions.
For Cloudflare email forwarding to work, you need to use the SMTP servers where the actual email addresses exist, but since Domains has no actual email service servers, the emails sent out are failing with email account does not exist. The instructions you mentioned are for the Google Apps, which have actual email/gmail addresses set up, but they cost $5/user/month.
The only solution that I can think of to get around this issue is to have our own mail server, and have cloudflare point to those, and then forward/deliver the emails from that mail server.
Hope this helps.
EDIT :
I probably didn't research this well enough before, but looks like people are getting around this issue by using a third party email forwarding service called mailgun
The actual article describing how to use it is on lowendtalk
Some discussion surrounding it is here

Have to verify my domain in MailGun, but unsure if i can add the DNS records in my hosting or domain provider

So before i can start sending emails with MailGun, i need to verify the domain with several DNS records, two TXT and one CNAME record. My problem is that am a bit confused to if these records should be added on the Domain provider or is the "Advanced DNS Zone Editor" in hosting's CPanel sufficient to make the DNS changes.
An additional question, can adding a CNAME record "email.domain.com" mess anything up for sending & receiving functionality?
I would be thankful if anyone could help me clear this up.
Thanks
Adding the described DNS records in the hosting account solved my problem.

How do I route Domains to my Dedicated Server in order to use e-mail

I think what I need is some general explanation as to how this works, but here is my problem.
I have a dedicated server with 1&1, everything is working perfect, I have several clients' websites on the dedicated server all running through different domains that I have purchased through 1&1.
The server is running ZPanel (Not for long, so please spare me the "risky choice" speech), and I have setup some mailboxes that RECEIVE e-mail perfectly!!! When it comes to sending e-mail, it doesn't for some recipients, and for others it goes straight to SPAM/JUNK.
What could be happening here? I understand it is a vague question, I can only assume the domain DNS settings are correct otherwise e-mails wouldn't be received at all right? Is this a mail server problem?
The dedicated server is running Linux 12.04-ish.
Any questions to help I am more than pleased to answer.
Thanks
From the top of my head, in order to avoid being flagged as spammer you will need a pointer record PTR mapping your domain to your ip address and a SPF record.
How it works:
Spam filters will check if your ip address belongs to the domain you're claiming it does. So it will do a reverse DNS lookup and if you don't have a PTR record it will flag the email as possible spam.
In addition to reverse dns lookup, some spam filters will also check the SPF Sender Policy Framework rules, if your ip address is not included in that rule it will flag the email as possible spam.
Take a look at rackspace email server:
tiago#dell:/tmp/test$ dig mx1.emailsrvr.com +short
108.166.43.1
Reverse DNS:
tiago#dell:/tmp/test$ dig -x 108.166.43.1 +short
mx1.emailsrvr.com.
SPF:
tiago#dell:/tmp/test$ dig txt emailsrvr.com +short
"v=spf1 ip4:67.192.241.0/24 ip4:98.129.184.0/23 ip4:173.203.2.0/25 ip4:173.203.6.0/23 ip4:50.57.0.0/27 ip4:108.166.43.0/24 ip4:173.203.187.0/25 ip4:204.232.172.40 ~all"
http://en.wikipedia.org/wiki/List_of_DNS_record_types#PTR
http://en.wikipedia.org/wiki/Sender_Policy_Framework
Thanks for the answer.
It turns out my Dedicated Server IP address was blacklisted which made Hotmail throw a hissy fit. Here is a tool you can use to check if your IP has been blacklisted: http://www.anti-abuse.org/multi-rbl-check/
It turns out, to be more specific about this issue, that I was using ZPanel which pretty much automatically blacklists IPs running ZPanel due to the obvious security flaws.
Thanks very much for the original answer and it did help me eventually track this problem down.

SPF record clarification - Is this set correctly?

I am not very familiar with SPF records so I need a bit of help setting up my SPF record correctly.
Below is a record I created using the Microsoft SPF record wizard
v=spf1 a mx ptr ip4:xxx.xxx.xxx.a ip4:xxx.xxx.xxx.b include:aspmx.googlemail.com include:mydomain.com -all
As you can see I use google apps, I also have two web servers sending mail on behalf of mydomain.com. I also listed two IPs both are web servers relating to mydomain.com and mail from mydomain.com are sent from both server (web app).
I also set the PTR to be xxx.xxx.xxx.a at my ISP. Considering all this and the fact that the above mentioned are the only places where mail get generated for mydomain.com is the above record correct?
Most of the results of this SPF specification depend on the MX entries of the domain. What you get here is:
a: Allow any host, an A record of the domain is pointing to (but not any subdmains, or hosts inside the domain)
mx: Allow any hosts with an MX record pointing to them
ptr: Allow all hosts where the PTR record matches an A record. Use this ONLY when you control both the reverse and the forward domains, and probably not even then as it results in some DNS overhead.
ipv4:...: Allow the named IP.
include:...: Include the servers allowed by SPF rules in the named domain. Google uses some redirection to allow all its sender hosts here.
I assume the SPF record is entered into the mydomain.com domain directly. The last include is superfluous and probably creates a loop.
After all, it looks rather correct (if you correct the mentiond include if applicable). But to understand what's going on, you should really read the specification, it's really simple in the end.

Email Delivery Question

This question comes on the heels of the question asked here.
The email that comes from our web server comes from an IP address that is different than that for the Exchange server. Is this okay if the SPF and Domain keys are setup properly?
Short answer: Yes
It should just fine. However some spam filters will do a reverse lookup on the originating IP address and see if it's assigned to the domain name the email claims to be from, and some may check to see if the IP is an actual MX for the domain.
So the downside is that some recipients may never get the email, and you may not know about it for a long time. I'd suggest routing your mail through an established MX rather than having a webserver do it directly (there are some security implications there too).