I'm currently trying to debug an Elgg-based website (I didn't develop it) and I would like to send the emails directly from local development machine (WinXP). I'm running WAMP with Apache 2.2.11 and PHP 5.3.0
After some searching, the simplest solution that I've come across is using fake sendmail to forward it to my GMail/Google apps account via SMTP and let it do the sending. The problem is that I get no errors whatsoever, but the email isn't being sent.
Here's what I did:
- Copied the sendmail.exe and sendmail.ini to a subfolder in WAMP
- Configured it via sendmail.ini (the configuration settings are ok)
- Edited php.ini to add the path to sendmail.exe
sendmail_path = "C:\Program Files\wamp\bin\sendmail\sendmail.exe -t"
- Commented out the windows SMTP settings in php.ini
; SMTP = localhost
; smtp_port = 25
; sendmail_from = xxx@domain.com
; mail.force_extra_parameters =
The mail.log file shows the following:
mail() on [C:\Program Files\wamp\www\mail.php:9]: To: xxx --
Headers: From: xxx Reply-To: xxx X-Mailer: PHP/5.3.0
My guess is that the problem is that the default Windows option (to specify the server and not the sendmail utility) is not overriden. In phpinfo()
I still get the SMTP -> localhost
and smtp_port -> 25
options, even though I commented them.
If anyone managed to get this working, I'd really appreciate some help. In my opinion, using fake sendmail is a lot simpler than installing a mail server on your machine.
Thanks!
P.S. Please don't suggest PHPMailer and the like, because I have to use the mail() function. That's how Elgg works.
...unless you're using a plugin that changes this behaviour:
http://community.elgg.org/pg/plugins/costelloc/read/16498/phpmailer
I've gotten it to work eventually. The problem was that PHP had a bug in parsing .ini files with spaces in the path (for sendmail). It was fixed in version 5.3.0, but the manual had no info on this.
So, yes, it is possible to use sendmail with PHP on Windows :D.
Thank you all for your time!
I am not sure if this helps or not, what i used to do in these scenarios was to setup , outlook on my machine and have it set to get emails from the pop every 5 mins or so, that way my ip/machine was authenticated against the pop and if i just set the :
in php.ini , the mail function worked fine. So in your case just set your outlook to work with a pop and use that smtp in php.ini and hopefully it should work. I havent tested this will GMail though.
Make sure you have SMTP Service running on your local machine and that SMTP Port(25) is opened.
Have a check on the services (Run->services.msc) and look for Send Mail Transfer
If you cannot find SMTP on the services list, you must install it: To add, Run->appwiz.cpl->Add Remove Windows components->IIS->Details->SMTP