How to configure Caddy for mail delivering with PHP mail() function

For me PHP (it’s 7.4 version) function mail() always returns status FALSE and the code is definitely correct, it’s works on Apache server.
Does Caddy 2 need any special configuration for delivering that email?
Thanks in advance, and my OS is Ubuntu 20.04

I’m quite certain this has nothing to do with Caddy. Caddy just takes a requests and hands it to php-fpm, then takes php-fpm’s response and sends it back to the client. It has absolutely no knowledge of anything related to mailing.

Do you have sendmail installed and configured on your system?

Thank you for answering, I just installed it, and it sends email now, but it takes 60 seconds every time for some reason, is there a way to do it faster?

I solved it, in case anyone needs this in the future, you need to set valid hostname in /etc/hosts in one line, like this:
127.0.0.1 mydomain.com myvps localhost

This topic was automatically closed after 30 days. New replies are no longer allowed.