I am setting up an Apache server (2.2.14) on Windows, and borrowing ideas from an existing XAMPP configuration. I am now trying to set up email functionality for PHP (5.3.1). (It needs to be able to handle attachments, just like the XAMPP server can.)
I've noticed that XAMPP comes with fake sendmail for Windows, but several things about the configuration don't make sense to me.
Here are a couple of lines from XAMPP's php.ini
:
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
This is weird because:
- It explicitly says "for Unix only," yet
- I keep seeing tutorials that say to use this line for Windows, and
- the example file path wouldn't even make sense in Unix
sendmail_path
is commented out by default
I wondered if sendmail.exe
is even necessary. So on my custom Apache server, which doesn't have sendmail.exe
, I edited php.ini
to add the correct information for SMTP
, smtp_port
, and sendmail_from
. With that, it was able to send mail! But it's very slow.
Then I went back to the XAMPP server and renamed the sendmail
directory, hoping to disable sendmail. That sort of worked - my PHP script claimed to have sent, but nothing happened.
So I'm very confused.
- My XAMPP server has
sendmail_path
commented out, but apparently still uses the program it points to. How does it know? - My Apache server has nothing in
sendmail_path
, but can somehow send mail without it. How does it do that?
What do I actually need to do to configure the Apache server to send emails?