PHP Mail Log

Normally, if one sent an email, a copy of it will appear in the user’s sent box.  However, if one sent an email by using the PHP sendmail function with a Bluehost outgoing mail server, no record will be automatically recorded.   One way to add tracking of what has been sent is by enabling log keeping via PHP.  To turn on PHP mail log:

  1. Open php.ini configuration file.  It should be located under xampp/php
  2. locate the following line:
    ; Log all mail() calls including the full path of the script, line #, to address and headers
    ; mail.log = "C:\xampp\php\logs\php_mail.log"
  3. Delete the semicolon before mail.log
  4. Restart Apache server.

From here after, all sendmail function will result in recording a record similar to the following in the php_mail.log file.

[28-Jul-2016 22:49:42 Europe/Berlin] mail() on [C:\xampp\htdocs\EmailProgram\lib\PHPMailer\class.phpmailer.php:653]: 
-- Headers: Date: Thu, 28 Jul 2016 22:49:42 +0200 From: Yvonne Lu <> 
Reply-To: Message-ID: <c8bb4f44b788e55c106fe2dc1767001e@localhost> 
X-Mailer: PHPMailer 5.2.10 ( MIME-Version: 1.0 Content-Type: multipart/mixed; 	boundary="b1_c8bb4f44b788e55c106fe2dc1767001e" 
Content-Transfer-Encoding: 8bit