I upgraded my local server using XAMPP 1.8.0 which contains Apache 2.4.2, PHP 5.4.5 and MySQL 5.5.
I send mails with PHP mail() function by running MercuryMail, but no email received in my inbox.
Sending mails are working when I tested with Mozilla Thunderbird. And the mail() function seems to be working with no error issued.
I checked php.ini in my XAMPP installation path D:\xampp\php. I saw this below
[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = localhost
; smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
; sendmail_from = postmaster@localhost
; 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"
I tweaked some combination of SMTP settings.
I commented out host and port
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = localhost
smtp_port = 25
I commented out sendmail_path, but it did not work. Mail could not be sent.
; 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"
Again, I commented out anothor sendmail_path to work with mailToDisk
; 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"
It seems working, but no mail received in inbox. Nothing found in D:\xampp\mailoutput
In php mail log (D:\xampp\php\logs\php_mail.log), I found several log lines which likely saying mails were sending.
mail() on [D:\xampp\htdocs\....:127]: To: [email protected] -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=text/html Return-Path:Sithu <[email protected]> From: Sithu <[email protected]> Reply-To: Sithu <[email protected]>
mail() on [D:\xampp\htdocs\....:127]: To: [email protected] -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=text/html Return-Path:[email protected] From: [email protected] Reply-To: [email protected]
mail() on [D:\xampp\htdocs\....:127]: To: [email protected] -- Headers: MIME-Version: 1.0 Content-type: text/html; charset=text/html Return-Path:Members <[email protected]> From: Members <[email protected]> Reply-To: Members <[email protected]>
I also tried to comment out sendmail_from, but no luck.
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = postmaster@localhost
Any configuration I'm still missing?
[Edit]
Mercury mail server is running.
Whenever I updated php.ini, I restarted Apache server.
So if you are using XAMPP then you can easily send mail from localhost. For example, you can configure C:\xampp\php\php. ini and c:\xampp\sendmail\sendmail. ini for gmail to send mail.
The Mercury Mail package in xampp for windows is a great way to start sending emails from openemr or any open source CMS program placed in xampp. The configuration is easy, just need to follow the steps: Benefits of Mercury Mail in openEMR. Easy to setup and integrated with XAMPP package.
Php uses by default, the local mail-server.
If you want to send emails from localhost directly, you need to install a Mail Transport Agent (MTA), or if you like, a SMTP service. IIS provides one. You can otherwise find some others on Google.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With