I'm trying to send mail from localhost using the PHP mail function. My test script, which is simply a call to the mail function, works fine on my host, but not on my computer (localhost).

I first tried sendmail, by editing the sendmail_path in php.ini like so:

sendmail_path = /usr/sbin/sendmail -t

That didn't seem to work. No email was received at my gmail account where I had tried to send the email. I checked the inbox and the spam folder. There was no error in my php log. In the mail log, I saw entries like this...

Jan 12 09:58:04 ubuntu sendmail[3438]: q0CEw3DD003438: to=myemailaccount@gmail.com, ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30083, relay=[] [], dsn=2.0.0, stat=Sent (q0CEw38b003439 Message accepted for delivery)

...where myemailaccount@gmail.com is my gmail address. I don't know how to read a mail log, but that entry looks pretty good to me, I suppose. However, I'm not seeing the email in my gmail account, and I've now waited a good while for it to show up.

What might I be missing?

Apologies if this is off topic for the ubuntu forum. I am using ubuntu, though I don't presume my problem here lies in how I'm using ubuntu. Not really sure.