PHP Mail function suddenly stopped working on server

Discussion in 'Installation/Configuration' started by deividmen, Jun 7, 2022.

  1. deividmen

    deividmen Member

    I have an Ubuntu 16.04 server with ISPConfig Version: 3.1dev. and many websites installed (I know I have to update my system). I also set up Postfix with an SMTP relay service (Mailgun).

    For some reason, the PHP Mail function stopped working, and now the WordPess sites can't send emails. The only way to send emails is using SMTP.

    When I try to send a test email with a special plugin, it shows the following error message:

    Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Just a guess, did you maybe use chrooted PHP in that site? If yes, then you must use PHP as postfix and its sendmail wrapper that is used by PHP mail() function are located outside of the jail.
     
  3. deividmen

    deividmen Member

    How can I check that? The problem is in every site actually, even the new ones that I create, but it used to work fine.
     
    Last edited: Jun 7, 2022
  4. deividmen

    deividmen Member

    I just figured out that it works after I changed the PHP mode from Fast-CGI to CGI. However, after I made that change the websites linked to subdomains won't work anymore.
     
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Have you tested PHP mode PHP-FPM?
     
  6. deividmen

    deividmen Member

    I tried but still the emails won't be sent. It only works when I change it to PHP mode CGI. However, I can't change the PHP version, and besides I would like to know why the websites linked to subdomains won't work with that mode.
     
  7. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    You could create a simple phpinfo() file and request it in both CGI and FAST-CGI mode to see which php.ini file is in use for each mode, then compare them.
     

Share This Page