No mail received in inbox with XAMPP 1.8.0, MercuryMail and mail()
I just need to configure D:\xampp\sendmail\sendmail.ini
By default, it contains the line
smtp_server=mail.mydomain.com
I had to change it to
smtp_server=localhost
No need to configure this in the older versions of XAMPP.
The correct configuration for [mail function]
in D:\xampp\php\php.ini is
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = 127.0.0.1
smtp_port = 25
; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesD:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.
; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"
; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the D:\xampp\mailoutput folder
; sendmail_path = "D:\xampp\mailtodisk\mailtodisk.exe"
Now, I'm receiving mails in my inbox. Please note that "D:\xampp\" is my XAMPP installation path.
Apache localhost mail() not being received with Mercury Server & Thunderbird
I commented out the following line and it worked.
; sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
For good measure, I changed this to:
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
I don't know why mailtodisk.exe is defaulted to being used, but it appears this simply writes the mail to a folder and it doesn't get delivered.
XAMPP mail not working with PHP mail() function
You would have to configure the mercury server bundled with xampp to actually deliver/relay the mails.
But I suggest you use something like SwiftMailer instead of php's mail() function.
edit: there is a third option. The mini-smtp-client built into php/win32 can't do authentication. Therefore you can't simply put SMTP=mail.gmail.com; smtp_port=25
in your php.ini. But you can set sendmail_path and point to an application that can relay the message to another smtp server (including authentication), e.g. fake sendmail.
(But I still suggest swiftmailer)
How do I enable XAMPP to locally use the php's mail() function so I can test my mail() scripts locally without having to upload to my server?
These helped me out when I was having trouble.
http://www.danieltmurphy.com/setting-up-mercury-smtp/
http://www.youtube.com/watch?v=VU4PT7xMSO0
Mercury can be activated from the Xampp control panel.
Related Topics
PHP File_Get_Contents() Behaves Differently to Browser
How to Access MySQLi Connection in Another Class on Another Page
How to Avoid Using PHP Global Objects
How to Start a Windows Gui Program Using PHP
Pdo Mssql Server - Driver Not Found
Google Recaptcha - Keep Getting 'Incorrect-Captcha-Sol'
How to Backup/Export the Connected Database Database.SQL File in Laravel
Why Is Turning Magic_Quotes_Gpc on Considered a Bad Practice
How to Subtract 24 Hour from Date Time Object in PHP
Connect to Azure Active Directory from PHP Web Application
PHP Static Method Call with Variable Class Name and Namespaces
Does the Use Keyword in PHP Closures Pass by Reference
PHP Dynamic Db Page Rewrite Url