PHP mailer and domains with MX not on local server

Mr_Q

Verified User
Joined
Sep 25, 2008
Messages
12
Hi,

As I couldn't find the answer using google / forum search I will have to ask it here, hopefully you have a good and proper solution for this.

For e-mail, a lot of my domains are using Google Apps to host the e-mail service. This works great, no problems so far. However, when I try to send a mail using a php-script, for example, just a contact form on a website, it does not deliver it properly. The e-mails will be delivered on the local webserver which, in my case, is not the mail server for my domain. The only way to resolve this, is to remove the domain from /etc/virtual/domains.

In the exim config file:
domainlist local_domains = lsearch;/etc/virtual/domains

When I remove the domain from this file, all my issues are resolved.
It also happens in the following situation:
A mail is sent to an e-mail address/domain that is on this same directadmin server. For example: [email protected].
This e-mail adres is an forwarder on the directadmin server to [email protected]. This googleapps-domain.com is configured for webhosting on this same server and is present in /etc/virtual/domains.

Since the mail was sent to [email protected], and googleapps-domain.com is also on this same server for webhosting the mail is delivered on the local domain. Even though the MX-records of the googleapps-domain are not set to the local server.


Can someone please come-up with a real solution instead of editting the /etc/virtual/domains file? Since this file is not accessible for all users?


Thanks in advance.
 
It is when you allow the users to manage their own MX records. That is what the check box is for. http://help.directadmin.com/item.php?id=8

http://www.google.com/search?q=external+mailserver+site:directadmin.com

This has be posted here many, many, many, ................. times.
Err.. That's not really the solution / what I am asking.......

It resolves the issue per domain, but what if I want to disable it permanently? So that it always checks where the MX-record(s) point to....
 
It may not be the solution you were looking for but it is what you asked about. You did not ask about all your domains but "a lot of my domains."

So you want this for all your domains. What if the MX record points to your server? Then what? If the domain is not in the domains file then it cannot be delivered.
 
Would it be possible to check the MX records first and then check the domains file when the MX records point to the local server?
That would be the most ideal solution in my opinion.
 
It may not be the solution you were looking for but it is what you asked about. You did not ask about all your domains but "a lot of my domains."

So you want this for all your domains. What if the MX record points to your server? Then what? If the domain is not in the domains file then it cannot be delivered.
Oh yeah, I forgot the question mark..... But I did tell what the issue was, exim looking into a local domains file......


Anyway.. Like ja3 said, it would be more logic to check the mx-records before looking into that file.. Technically it shouldn't be needed, the local file.. if the IP is a local IP then it should be delivered locally.. And apart from delivering it locally.. What if it 'connects' to it's own via the public IP-address? Should still work in my eyes.......
 
Take 5 minutes out of your day and write a script that will go through the list of domains and check the MX records. If the MX records do not point to the local server then remove it from the domains file. Simple. And it takes a lot less time to do that than to try to rewrite the way exim works. Run the script as a cron job.

But if you really want to change the way exim works then you need to be posting on the exim list.
 
I'm the guy who wrote the exim.conf file used by DirectAdmin, so please let me put in my two cents (US) worth:
It resolves the issue per domain, but what if I want to disable it permanently? So that it always checks where the MX-record(s) point to....
Sure, but if you did that the mail would never get delivered; it would simply trigger an error that the MX records points to the local machine. Then the system would try to return the email, but of course that wouldn't work either; and the email would eventually get frozen in the queue, and later get deleted. I'm sure that's not what you want.
ja3 said:
Would it be possible to check the MX records first and then check the domains file when the MX records point to the local server?
That would be the most ideal solution in my opinion.
Possibly, with a complete rewrite of how exim uses mail routing. Perhaps you should volunteer your services to the exim team.
Mr_Q said:
Anyway.. Like ja3 said, it would be more logic to check the mx-records before looking into that file..
See my response to user ja3. The authors of exim don't think it's logical and neither do I, because local delivery means local delivery, and it's considered bad manners to ask for external DNS resolution for something you know is on your server. If you could convince exim developers to make the change, probably every exim user would end up on the rfc-ignorant blocklist.
Technically it shouldn't be needed, the local file.. if the IP is a local IP then it should be delivered locally..
No, see my note above, it would result in the mail ending up in the queue as undeliverable, being frozen, and eventually being deleted.
And apart from delivering it locally.. What if it 'connects' to it's own via the public IP-address? Should still work in my eyes.......
Same as above.

I'm guessing that you believe you know quite a bit about the RFCs and about email should work, so perhaps you should get involved in a group rewriting how email works. No I'm not being facetious; a lot of people think email is undeniably and irreparably broken.

Personally I believe that Dr Philip Hazel knows what he's doing a bit more than I do.

I like floyd's suggestion, but even that requires that you remember to add the domain back to the list if you ever move the mail service back to your server.

Jeff
 
If you are changing the MX records anyway really how much harder is it to uncheck the box? Is it really too hard for somebody to do?
 
Well, to be honest, I really have my doubts if the standards wrote that you should first check a local file.. Since that is not written in the standard afaik and can imagine. Especially because you can have a dedicated smtp and a seperate pop3 server....

Anyway, it is not the amount of work, the difficulty of unchecking the box, neither the time it takes. It's more that if you do not know that option, which I and two other DirectAdmin-server admins didn't know of.. (it's not in the DNS-menu where you change your NS-records)..

The other point is that if you are unaware of this Exim-behaviour (if I may call it this way, which is normal you mentioned a couple of times) .. Just like users which do not know anything about nameservers, ns-records etc, but the ones that are just following the tutorial of google's help pages, are happy that they got google apps working with the MX-records, but do not have an idea why it only works for a part.. (which is, external domains/scripts of that server)

Thanks for the replies and your time anyways, you got your point that it won't change within Exim/DirectAdmin.
 
Last edited:
it won't change within Exim/DirectAdmin

What you really mean is that it won't change how email works since it is not Exim specific.

Email is designed like this to make it faster to deliver email and avoid extra unnecessary DNS lookups.

I am sorry you do not like it.

are just following the tutorial of google's help pages

See now you have gotten to the root of the problem. Google's incomplete tutorial.
 
What you really mean is that it won't change how email works since it is not Exim specific.

Email is designed like this to make it faster to deliver email and avoid extra unnecessary DNS lookups.

I am sorry you do not like it.



See now you have gotten to the root of the problem. Google's incomplete tutorial.

It's not 'how e-mail works', it's how it is implemented in Exim (and yes, probably in the most e-mail apps). If you are that sure that it is done according to the standard, please refer to that standard/stanza instead of jelling something without any ground documents or whatever.
 
It's not 'how e-mail works', it's how it is implemented in Exim (and yes, probably in the most e-mail apps). If you are that sure that it is done according to the standard, please refer to that standard/stanza instead of jelling something without any ground documents or whatever.

Well if everybody does it then its considered a standard even if it is not documented. There are plenty of things in life that are undocumented standards.

But on the other hand

If you are that sure that it is done according to the standard, please refer to that standard

I have never said it was a standard.

By your own admission it is not a DirectAdmin problem. Its the way email works that is the problem. You admit that probably most email servers work this way. So your issue is not with DirectAdmin and therefore does not belong in this forum.

I am not going to do the research to prove to you that it is supposed to work this way. YOU prove to us that it is not. YOU show us documentation that proves us wrong. YOU are the one that needs help with this issue. YOU came here asking for such help.

If you want to offend the very ones trying to help you then that is just stupid. If you don't want to listen that that is fine. When people don't listen then they are simply ignored.
 
Well if everybody does it then its considered a standard even if it is not documented. There are plenty of things in life that are undocumented standards.

But on the other hand



I have never said it was a standard.

By your own admission it is not a DirectAdmin problem. Its the way email works that is the problem. You admit that probably most email servers work this way. So your issue is not with DirectAdmin and therefore does not belong in this forum.

I am not going to do the research to prove to you that it is supposed to work this way. YOU prove to us that it is not. YOU show us documentation that proves us wrong. YOU are the one that needs help with this issue. YOU came here asking for such help.

If you want to offend the very ones trying to help you then that is just stupid. If you don't want to listen that that is fine. When people don't listen then they are simply ignored.
Heh, it is just what you define as as 'standard'. But yes, it was obvious that, atleast Jeff, was pointing to the RFC-standards and not 'the community standard'.

I do not say it is implemented this way in all e-mail apps, I said that it probably is, big difference mate :) ..

As you can run an dedicated SMTP-server with Exim-only, or any other app, it is enough prove it is not needed or proven that it 'has to work' this way, according to your standards.. And no, I do not need to prove anything, I know how it works, I admitted that it works that way and agreed that it will not change within Exim/DirectAdmin. That is different then saying that it is 'the standard' without referring to a real standard.

I never said it was a problem, wrong again, but I won't go into detail on this one.... :) I did thank you and Jeff for your replies and I am thankfull for that, didn't I say thanks in my previous replies?

Anyway, there are different ways to approach people, and yours is defenitely not the way of treating people nice if they do not agree with you.

But let's not go further into this useless conversation cause it doesn't make sense at all. Thanks for the time you took to read/reply to my questions.
 
I said that it probably is, big difference mate

Its like you don't even read my posts. "Probably" is what I said too in quoting you.

that it will not change within Exim/DirectAdmin

Why do you keep bring DirectAdmin into this? DirectAdmin cannot change the way Exim works. DirectAdmin is not a mailserver. You need to take this up with the Exim community and they will set you straight on why it works the way it does. Who knows, maybe they will even listen to your suggestions.

and yours is defenitely not the way of treating people nice if they do not agree with you.

And its like you do not even read your own posts.

And I don't really care if you agree with me or not. Its not me that you disagree with. You disagree with the community in general on how things should work. I am not offended even if you do disagree with me. I am however offended when I am accused of saying things I did not.
 
Its like you don't even read my posts. "Probably" is what I said too in quoting you.



Why do you keep bring DirectAdmin into this? DirectAdmin cannot change the way Exim works. DirectAdmin is not a mailserver. You need to take this up with the Exim community and they will set you straight on why it works the way it does. Who knows, maybe they will even listen to your suggestions.



And its like you do not even read your own posts.

And I don't really care if you agree with me or not. Its not me that you disagree with. You disagree with the community in general on how things should work. I am not offended even if you do disagree with me. I am however offended when I am accused of saying things I did not.

I think I made my point ;)
 
I think I made my point ;)

But you made it in the wrong forum. You need to go make it in the Exim forum since we and DirectAdmin cannot change the way Exim works.

Edit: I forgot that I already said you need to go to the exim list if you want to change the way exim works in post #7. Why you continued to complain to us I have no idea. We don't write Exim.
 
Last edited:
But you made it in the wrong forum. You need to go make it in the Exim forum since we and DirectAdmin cannot change the way Exim works.
And you made your point too, sorry that I did not clarify that. Was it your last reply or?
 
Edit: I forgot that I already said you need to go to the exim list if you want to change the way exim works in post #7. Why you continued to complain to us I have no idea. We don't write Exim.

Editing is also a way of responding offcourse...... :D

But to give your edit a reply, I know that I should not be here, you made your point already 3 replies before. I never denied that? :)

The last replies were not about Exim/DirectAdmin but about your standards / replies.. :) Please stop filling Google's database with crap. :p, this will be my last reply, I again made my point I guess.
 
The last replies were not about Exim/DirectAdmin but about your standards / replies.. :)

Please try to stay on topic. My personal standards and the manner in which I reply is not relevant to the thread.
 
Back
Top