cPanel email routing... if not found locally try remote - email

I've got a weird setup with my emails that I need someones brain to look at. I've got it setup like this so that most of my emails are on one server (server1) and then 1 single account is setup on a second server hidden from the rest (server2)
Email Sent to user1#domain.me
MX record for domain.me = mail.domain.me
A record for mail.domain.me = server1 (11.11.11.11)
Email forwarding rule forwards all email sent to user1#domain.me to user#2.domain.me
MX record for 2.domain.me = mail2.domain.me
A record for mail2.domain.me = server2 (22.22.22.22) a cpanel server
Email hits my server now addressed to user1#2.domain.me
Domain forwarding rule forwards all email sent to #2.domain.me to #domain.me
This works great however my mail routing in cpanel is set to local, and therefore when sending emails out on server2 (22.22.22.22) to users#domain.me they're always delivered locally first and foremost
Is there any way around this? so that outgoing mail on this domain obey's DNS records (the mx records) and delivers it firstly to server1 (11.11.11.11) as if it was being sent from any other domain, gmail etc. Perhaps if the account isn't found locally then send on out to the web? Or perhaps there is a way to setup an alias somehow to let the local account receive mail for user1#2.domain.me
Thanks for your time & efforts looking into this
Henry

Check if your remote domains are listed in /etc/remotedomains and /etc/secondarymx. Note that if your second server has a dns server, it will try fetch the dns data locally first.
I have 2 servers using cpanel where each server acts as the other's backup and I don't have the issue you described.

Related

Can I run an email Server with a fixed IP only?

I created a web app to do some basic content management for just myself. I want to mail some docs to the server instead of downloading then uploading them. Ive been looking at postfix but everything assumes you have a domain. Is it possible to receive email at a server with a fixed ip and no domain?
if you want anybody and any app to be able to send mail you need MX records in DNS. And MX records point at dns server names, not IP addresses.
https://serverfault.com/questions/663112/why-cant-mx-records-point-to-an-ip-address
If its just you then you can telnet to the SMTP port to send mail

How to connect my Mac Mail to my domain which his DNS are handled through DigitalOcean?

I bought a domain.
I pointed his name servers to:
ns1.digitalocean.com
ns2.digitalocean.com
I have added a CNAME record point to #
I want to send and receive emails using my Mac mail program.
I know that I should probably build a full mail server which is an awful thing to do.
Therefore, I have another server (not digitalocean) running on cPanel. In this cPanel I have a very powerful cPanel's mail server.
How can I point my digitalocean CNAME to the remote server where the cPanel is?
I hope it's clear enough.
In order to make your domain points to the digital ocean server, you will have to create A record that points to the IP of that server, same goes to any subdomain.
Regarding your mail server, you need to make mail.mydomain.com points to the IP of your cPanel server using A record not CName and also modifying other records like SPF/DKIM records.
For your local mail client you can get the configuration by logging into the cPanel user account and view the mail settings

receiving mail on an ec2 instance (without my own domain)

I have an EC2 instance that I am using for a test project. I would like to send emails to it but I actually do not need to send emails from it.
I have port 25 open and have installed mailx for handling the emails. When I type mail i get No mail for ec2-user though i have already sent an email there.
My needs are real basic a few emails sent so I don't really need an industrial strength solution.
I know I also need to set up an MX record but this, I think, is where I am getting confused. So the email (at least according to github) is ec2-user#ip-XX-XXX-XX-XXX.us-west-2.compute.internal (x's replace the ip).
When I follow these instructions for setting up the MX record http://kb.kerio.com/product/kerio-connect/server-configuration/mail-delivery-and-dns-records/what-is-an-mx-record-and-how-is-it-created-1210.html, I get an error:
>[ec2-user#ip-xx-xxx-xx-xxx ~]$ nslookup
> server
Default server: 172.16.x.xx
Address: 172.16.x.xx#53
> set q=MX
> ip-xx-xxx-xx-xxx.us-west-2.compute.internal
Server: 172.16.x.xx
Address: 172.16.x.xx#53
Non-authoritative answer:
*** Can't find ip-xx-xxx-xx-xxx.us-west-2.compute.internal: No answer
Authoritative answers can be found from:
us-west-2.compute.internal
origin = ns0.us-west-2.compute.internal
mail addr = hostmaster.amazon.com
serial = 201210xxxx
refresh = 3600
retry = 3600
expire = 3600
minimum = 60
>
again x's where the ip is.
What's a direct way of just setting up the mx record on ec2 so i can receive a few emails? I don't have a domain for this other than what ec2 provides.
You can't set up an MX record in a domain you don't control... but you do not actually need an MX record when the host receiving the email is the same as the one to which the host is addressed.
You do, however, need to use your EC2 instance's external hostname, since the internal one isn't meaningful anywhere except... internally.
This will be in a form more like ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com.
Using this, you should be able to configure ec2-user#ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com as a working email address -- although, for what it's worth, you really shouldn't be using the "ec2-user" account... you should have created one of your own.
You will need more than mailx to "handle" the emails; you also need an email server like exim4 running on your machine, and that server software needs to be configured so that it realizes that ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com is a host for which it should accept incoming email.
I'm not sure that you will be able to test this without a domain, short of opening up port 25 and telnetting directly to the port.
Take a look at Receiving email with Amazon EC2? for some clues as to what you need to get started.

Switched exchange servers, kept the same e-mail but some incoming mail is still going to the old server

I recently switched from an axoim exchange mail server to microsoft 365 exchange server. Now my email address is still the exact same as it was, and most of the incoming mail comes to my new server and address, but it looks like some incoming mail is still going to the old server. Why is that and what can i do to address it?
I'm assuming that you changed the MX records for your domain, so that they now point to Microsoft 365's mail servers, correct? If so, it may take a day or two for the DNS changes to propagate.

Accept All Incoming Email Messages on Server

I want to write some email scanning software and don't understand how to setup my server. I have a hosted web server running Windows 2003 Server. It is running the Default SMTP Virtual Server with a fully-qualified domain name of abcdef.com (example). DNS is pointing abcdef.com to my server. If I spoof an email from my desktop pc so that it appears to come from info#abcdef.com, and I send the email to a 'non-existant' email address then the bounceback does arrive on my web server and is stored in C:\inetpub\mailroot\Queue on the server - great! (I can scan it and handle the bounceback). However, if I simply send an email straight to info#abcdef.com then it does not seem to get placed anywhere on the server. I don't understand why bouncebacks get stored but other incoming email doesn't. I'm keen to avoid having to install any 'email server software' on the server, as I want to keep things as clean as possible. All I really want is some way of telling the server to accept all incoming messages to abcdef.com so that I can process them myself, and to place the .eml files in a known directory that I can scan. I'll then write an eml file parser to process the files.
Thanks very much.
A possible reason for the lack of delivery is that your domain has a DNS A record, but no DNS MX record. MX records are used for delivery of mail. Historically, if no MX record was present for a domain, mail servers were supposed to fall back to looking for a domain's A record.
In your case, I'd guess that your local mail-sending software is looking for an MX record and then stopping if it doesn't find one, whereas the remote system sending you the bounce is looking for the MX record and then looking for an A record when it can't find one.
The Wikipedia article on MX records has more details.
SMTP is a message transfer agent (MTA), responsible only for handling the transfer of mail from one point (the client, perhaps) to another (the mailbox server, such as a POP or IMAP server). SMTP servers aren't the right tool for ultimately handling mail coming INTO a domain -- they only handle transferring the mail coming into a domain to another app, such as the aforementioned POP or IMAP server, which then know how to sort and store that mail.
In short, the Default SMTP Virtual Server isn't the tool you're looking for for your project.
From this other StackOverflow question, it looks like there are a few SMTP servers which are intended for development use but which might serve the purpose you seek -- they accept incoming messages and then write them to files (in some manner, and with some tweaking).
Ok, working now. Issues were as follows:
There was no MX record, so external email wasn't being directed to the server. The .EML file that existed on the server was indeed placed there by an outbound email process.
The firewall was blocking port 25 - now opened.
It is necessary to have some sort of inbound email service running on the server. Windows Server has a lightweight POP3 service which you can configure to place all incoming email into a single 'catch-all' mailbox. This fills with .EML files, which can then be scanned by our custom service.
Many thanks to delfuego & Jon.