Enable PHP mail(...) Function on XAMPP for Windows

How to Configure mailtodisk.exe in the php.ini Configuration File

Configure mailtodisk.exe

The mailtodisk.exe is included in the XAMPP installation, so you don't need to download or install any additional components.
mailtodisk.exe: "A win32 executable in the PHP environment as sendmail dummy for writing emails on local-disk."

 

Folders:

 

Edit php.ini Configuration

1. Open the php.ini located in C:\xampp\php and search for the section: [mail function]
e.g.

[mail function]
; For Win32 only.
; http://php.net/smtp

SMTP=localhost
; http://php.net/smtp-port
smtp_port=25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com


; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =


; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =


; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog

 

2. Comment out "SMTP=..." and "smtp_port=..."
e.g.

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=localhost
; http://php.net/smtp-port
;smtp_port=25

Important: If you haven't commented out the two lines, it won't work.

 

3. Set the sendmail path to mailtodisk.exe and set the default "sender" email address
e.g.

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=localhost
; http://php.net/smtp-port
;smtp_port=25

sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
sendmail_from=me@example.com

 

4. Optional: Set the logfile path
e.g.

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=localhost
; http://php.net/smtp-port
;smtp_port=25

sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
sendmail_from=me@example.com
mail.log="C:\xampp\mailoutput\php_mail.log"

 

5. After these changes, the [mail function] section should look something like this:

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=localhost
; http://php.net/smtp-port
;smtp_port=25

sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
sendmail_from=me@example.com
mail.log="C:\xampp\mailoutput\php_mail.log"


; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename

mail.add_x_header=On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog

Disclaimer: The information on this page is provided "as is" without warranty of any kind. Further, Arclab Software OHG does not warrant, guarantee, or make any representations regarding the use, or the results of use, in terms of correctness, accuracy, reliability, currentness, or otherwise. See: License Agreement