Exim error: php mail not working, smtp connection error (seems fixed, need feedback)

HolyDiver

Verified User
Joined
Feb 21, 2016
Messages
51
I should first state I fixed the exim error, but I'd like a second opinion about the choices I made to fix it in case it could result into problems in the future. Otherwise it might be useful for anyone googling this.

---

My exim broke when I updated to 4.92. Going back to 4.91 had no effect, so I switched back to 4.92 to get the security fixes. Initally the only thing that seemed broken was php's mail function. I could've switched to SMTP-only, but I could not determine if more things were broken, so I really wanted to fix this.

A phpinfo() file showed me the mail log used by php and from there I could determine php's mail function is actually handled by exim4. The way of configuring exim4 seemed confusing, so I went for the most simple way with dpkg-reconfigure exim4-config. It showed only local mail (so no mail to remote adresses) was enabled. When I changed this setting to Internet, php's mail function started to work again.

But now mailing through clients such as Roundcube stopped working. I could not find any log that gave me any helpful feedback aside from a generic "SMTP connection failed". With netstat -lnp | grep :25 I found out the SMTP port was occupied by exim4 which apparently should be occupied by the regular exim. I stopped exim4 and exim took over the SMTP port. SMTP now works as well as php's mail function. I started exim4 again, but it doesn't seem to matter.

---

Even though fiddling with exim4 helped the mail function work again, it feels like exim does all the lifting now? Should I have left exim4 untouched? Was local mail setting for exim4 the default setting for DA installations? How does exim4 function toward DA in relation to exim? Could my initial problem just have been a random thing?
 
Hello,

DirectAdmin manages Exim from its own repository. You should remove exim4, the only reason it might exist on your server is that it was installed as a dependency for another package. After you remove exim4 you might need to re-install exim and exim.conf from Directadmin.

Code:
cd /usr/local/directadmin/custombuild
./build set exim yes
./build set eximconf yes
./build set eximconf_release 4.5
./build exim && ./build exim_conf
 
Thanks for your answer, that explains a lot.

Seems like exim4 is a default install by my OS. I did exactly what you said, but I did have to reboot my server, because php and smtp weren't adjusting to the changes, leading to massive errors. All seems to be working as it should now :)
 
Last edited:
Back
Top