php.ini
First you should revert your "php.ini" to the default state. Only enable the line (remove the semicolon) with sendmail_path. So this part of the "php.ini" should looks like:
- Code: Select all
[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 = postmaster@localhost
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
; 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(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"
sendmail.ini
Your "sendmail.ini" should be something like:
- Code: Select all
# Example for a user configuration file
# Set default values for all following accounts.
defaults
logfile "C:\xampp\sendmail\sendmail.log"
# Mercury
account Mercury
host localhost
from postmaster@localhost
auth off
# A freemail service example
account Home
host Outgoing_mail_server_from_outlook
from E-mail_Address_from_outlook
auth on
user User_Name_from_outlook
password Password_outlook
# Set a default account
account default : Home
Now delete the file "C:\xampp\sendmail\sendmail.log" if its exists and restart Apache. Put this "mailtest.php" in "C:\xampp\htdocs":
- Code: Select all
<?php
error_reporting(E_ALL);
var_dump(mail('E-mail_Address_from_outlook', 'testmail', 'This is a testmail.'));
?>
Access this file in your browser with http://localhost/mailtest.php.
- what's the output in your browser?
- what can you read in "C:\xampp\sendmail\sendmail.log"?
- (after a delay) can you see this new mail in Outlook (maybe also check the spam folder)?