First of all, PHP is not an MTA (Mail Transport Agent, which is an email
server). All the mail() function does is connect to an MTA. To do
that, you either need one running on your system, or on a system you can
access.
There are several options in your php.ini file which controls this. For
instance, if sendmail_path is set (it must contain the full path to your
sendmail executable), it will look for the executable on your current
system, which is almost always supplied with the MTA (it would be
possible to have a program which connects to a remote MTA instead, but
this is much more complicated). Another way is to set SMTP and
smtp_port to the host name (or ip address) and port of your MTA.
But even a correct configuration will not necessarily work. For
instance, the PHP mail() function can only handle MTAs which require no
authentication (common for a local MTA, but should be non-existent for a
remote MTA).
Additionally, nowadays many ISPs are blocking outbound port 25,
especially for residential customers, because this how email traffic is
sent between servers, and therefore is an easy way to generate virtually
untraceable SPAM. Port 587 is designated for users to connect to their
MTA, but this port should ALWAYS require a signon.
Finally, even though get everything set up right and the email does in
fact get sent, it could be rejected by the receiving MTA for many
reasons - the most common (other than an incorrect address) being
something triggers the spam filters. But every system is different, so
it's hard to tell why that happens.
So, you can see some of the problems here. Several things you need to
do to find why your email isn't being received.
The first thing, as Rudy indicated, is to check the response from your
mail() command. If that is returning false, the email is never getting
to the MTA. You need to ensure you can access your MTA without
requiring authentication; the parameters I indicated earlier are a start.
If mail() returns true and you still don't see the mail being received,
you need to look at your MTA's log to see what it says. It should have
some clues on what's causing your problem.
Finally, if you can't access your MTA without authentication (as in most
ISPs), I recommend PHPMailer (
https://github.com/PHPMailer/PHPMailer).
It's more flexible and can handle MTAs which require authentication. In
fact, I recommend using it over the mail() command anyway, because it is
so much easier to use.
So, check these things out and feel free to come back if you're still
having problems. And good luck.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstu...@attglobal.net
==================