PHP Mail() Logs for Error Analysis

For IONOS Web Hosting Packages

If your PHP script sends emails using the PHP function mail() and you need more information about the status of the sent emails, you can set all activities to be recorded in a log file .


  • Open a text editor on your computer, such as Notepad in Windows.

  • Copy the following line and paste it into the text editor.

    sendmail_path=/usr/sbin/sendmail -t -i -X mail.log

    This instruction causes a text file called mail.log to be created in the directory of the script, in which an entry with information about the sending process is written for each email.
  • Save the file under the name php.ini.

  • Upload your php.ini file to the directory of your webspace that contains the script for sending the emails.

The change is active immediately. You can now check the sending of future emails using the information stored in mail.log. To do this, simply download the file to your computer and open it with a text program of your choice.

Logging SMTP Communication

If you need very detailed information about the sending of your emails, you can additionally log the communication with our SMTP server. You can then track the responses of the IONOS SMTP server step by step and identify possible causes of problems. To use advanced logging, add the following statement to your php.ini file. Use it to replace the previous statement, if any:

sendmail_path=/usr/sbin/sendmail -t -i -X mail.log -d >> debug.log
Now, in addition to the mail.log file, the debug.log file is created which also contains the communication history with the SMTP server.