0

I am trying to send mail using PHP but it doesn't seem to be working.

I am running Mac OS X Snow Leopard.

I've tried a simple PHP script using mail(), which doesn't write anything to /var/log/mail.log

Does anyone have any ideas?

Sandip Armal Patil
  • 6,241
  • 21
  • 93
  • 160
terrid25
  • 1,926
  • 8
  • 46
  • 87
  • 4
    No errors? Output in the PHP error log? Is sendmail installed, working and configured? – Rob Jan 01 '11 at 21:35
  • The script was supposed to say either meant to say success or failed, script was blank. nothing in /var/log/mail.log its a pretty new installation of Snow Leopard. Isn't sendmail installed by default? – terrid25 Jan 01 '11 at 21:39
  • Can you add your script to your question? – Sujith Surendranathan Jan 01 '11 at 22:19
  • If you're certain that the mail is actually being sent, you may want to check your spam folder? I suspect that mail sent by a personal computer isn't super reliable. – Chris Henry Jan 01 '11 at 22:57

4 Answers4

1

Natively, you are unable to send mail from your computer. You need to configure this in the php.ini file using SMTP (perhaps using Gmail). Consider reading this article, it will clarify things:

https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1045471.html

The article is a bit extensive, but it should give you a thorough understanding.

Hope this helps

Community
  • 1
  • 1
Adrian Carolli
  • 695
  • 6
  • 21
0

Once this happened to me; What I did was I made it send a mail message via SMTP(gmail account) and that fixed it. I dont know what caused it, perhaps a lack of an SMTP server. (on my ubuntu computer, but same thing i guess)

Souleiman
  • 3,360
  • 4
  • 23
  • 21
  • Can this be configured in the php.ini file? – terrid25 Jan 01 '11 at 21:48
  • Another thing to consider, some ISPs will block outgoing mail unless it goes through their mail server. – Matt Healy Jan 02 '11 at 04:30
  • @user390426 No, you need to do it seperately. I did it by way of calling a simple python file, but for example: http://www.vulgarisoip.com/?p=17, or http://stackoverflow.com/questions/712392/send-email-using-gmail-smtp-server-from-php-page. Good Luck! – Souleiman Jan 02 '11 at 15:19
  • @user390426 Actually, look at Adrian Carroley's answer. it seems to do the trick. – Souleiman Jan 02 '11 at 15:24
0

Does this help? PHP, mail() and OSX Leopard

Sujith Surendranathan
  • 2,569
  • 17
  • 21
0

You can try:

sudo postfix start

in Terminal

user33994
  • 61
  • 1