Sending email to same domain but on an external MX?

Problem Description

I’m a bit confused as to how to do this (or if it’s really the problem) - i’m hosting a website - lets call it example.com - and i have some php sending to someone@example.com - the DNS for example.com is managed externally with the A-records pointed at the server, and they have their own separate mailserver so the MX is routed elsewhere (so i’ve not configured any local inboxes).
The emails aren’t currently getting through to addresses at the same domain (but do deliver to eg @gmail.com addresses) - i’m guessing(?) that as i’m trying to send to the same domain as the current host it’s just trying to deliver to a local user - would that be the case and is it possible to tell exim/dovecot to ignore local for the domain and just send via it’s proper external MX?

(sorry if this is really obvious - mail config isn’t my forte!)

Rick.

As I understand it, mail is handled locally if there is either
a mailbox directory /srv/example.com/mailboxes/someone
or an entry for ‘someone’ in /srv/example.com/config/aliases

If neither of those conditions is true, exim4 config looks for an external MX specified in the DNS records.
I’ve had problems like that… I think it’s similar to your case.

It’s worth checking that theres no hosts entry for the site as well, as that will override any DNS.

If so (and it’s the default site) you’d need to change the server hostname to something else.

What is the real domain that you’re asking about? It’s hard to diagnose email problems without knowing the domain. Much easier, for example, to check if we can look at the DNS for the domain.

Oh, and where do you actually want the emails delivered? Locally, or to the MX server?

Sounds like OP would like to have mail go to the external MX server. Something I’ve recently been thinking about as hosting my own mail is getting more time consuming…