PHP mail() not working

brooky

New member
Joined
Oct 10, 2024
Messages
7
Hi Guys,

I'm now here... ditching cPanel.

I can't get PHP mail() to deliver. I'm using Cloudflare for DNS and email for my domain is provided by G-Suite.

What settings do I need in Direct Admin to get email to deliver.

Exim mainlog shows for example:

2024-10-10 09:42:13 cwd=/home/cubecart/domains/xxx.com/public_html/admin 5 args: /usr/sbin/sendmail -t -i -f [email protected]
2024-10-10 09:42:13 1sypgT-00000000Awz-0WWH <= [email protected] U=cubecart P=local S=10307 T="Test Email AAA" from <[email protected]> for [email protected]
2024-10-10 09:42:13 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1sypgT-00000000Awz-0WWH

Nothing arrives to my inbox [email protected] I see further logs errors:

2024-10-10 09:42:13 Received from [email protected] U=cubecart P=local S=10307 T="Test Email AAA"
2024-10-10 09:44:25 H=aspmx.l.google.com [74.125.206.27] Connection timed out
2024-10-10 09:44:25 [email protected] R=lookuphost T=remote_smtp defer (110): Connection timed out

It seems like it's trying to send the email via google instead of locally. I've attached a screenshot of my MX Records in Direct Admin. Any tips?

Screenshot 2024-10-10 at 10.46.39.png
 
Following on i've added a file/etc/exim.variables.conf.custom with content;

disable_ipv6=true

2024-10-10 10:30:01 Received from [email protected] U=xxx P=local S=10296 T="Test Email"
2024-10-10 10:32:10 H=aspmx.l.google.com [142.251.173.26] Connection timed out
2024-10-10 10:32:10 [email protected] R=lookuphost T=remote_smtp defer (110): Connection timed out

I've even disabled the firewall and still no joy. Getting really frustrated.
 
Try:
Code:
telnet 142.251.173.26 25

If it fails - it means external or internal firewall is blocking outgoing port 25.
 
Thanks for your help.

Code:
telnet 142.251.173.26 25
Trying 142.251.173.26...
telnet: connect to address 142.251.173.26: Connection timed out

Firewall. I'm using a Vultr VPS with no firewall and seem to get the same result with CSF turned off. Ha. You've helped me at least figure out the problem. I will tinker.. thanks.
 
Your VPS provider might not have port 25 open for your VPS. That would need to be opened for email to work.
 
Back
Top