10 Replies - 1418 Views - Last Post: 25 August 2009 - 07:45 AM Rate Topic: -----

#1 codemaker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 25-July 09

Mail function doesn't work

Post icon  Posted 24 August 2009 - 09:09 AM

Hi guys,
I'm trying to use mail() PHP function, the function is working fine but I don't receive any email. I have LINUX box(fedora 11) and sendmail service is working fine. If you need any config files, I would be happy to provide you with.

Thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: Mail function doesn't work

#2 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,004
  • Joined: 08-August 08

Re: Mail function doesn't work

Posted 24 August 2009 - 09:18 AM

Please post your php code.

I suggest you use something simple to start:
<?php
mail("required","info","as","text");


Was This Post Helpful? 0
  • +
  • -

#3 codemaker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 25-July 09

Re: Mail function doesn't work

Posted 24 August 2009 - 09:28 AM

I use the mail() function as the following:-

<?php
$to="ex@domain.com";
$subject="Test";
$body="Blah, Blah, Blah";
mail($to,$subject,$body,'From:admin@domain.com');
?>



I think that is the simplest way to use it, without mime or any additional headers.
Was This Post Helpful? 0
  • +
  • -

#4 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,004
  • Joined: 08-August 08

Re: Mail function doesn't work

Posted 24 August 2009 - 10:12 AM

Try using "yourusername@localhost" as the recipient. If you receive that, then the php is working, but probably blocked by your isp.
Was This Post Helpful? 0
  • +
  • -

#5 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 900
  • Joined: 08-August 08

Re: Mail function doesn't work

Posted 24 August 2009 - 03:29 PM

mail() will not work on a localhost eg xampp or wampp or whatever, so if youre trying to do that then it wont work

get a free host if you have too
Was This Post Helpful? 0
  • +
  • -

#6 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2889
  • View blog
  • Posts: 10,004
  • Joined: 08-August 08

Re: Mail function doesn't work

Posted 24 August 2009 - 04:00 PM

It works on mine! Maybe it doesn't work on Windows, but it should work on *nix systems.
Was This Post Helpful? 0
  • +
  • -

#7 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 900
  • Joined: 08-August 08

Re: Mail function doesn't work

Posted 25 August 2009 - 03:38 AM

hmmm, CT ive read in lots of places that the mail function wont work on a localhost. ive never tried it i just accepted it. is there anyone that could clarify this ?
Was This Post Helpful? 0
  • +
  • -

#8 Auzzie  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 43
  • View blog
  • Posts: 573
  • Joined: 20-January 09

Re: Mail function doesn't work

Posted 25 August 2009 - 03:52 AM

mail() works fine on *nix mainly because SMTP gets installed in a standard install for a *nix OS and it is achieveable with free software for windows
Was This Post Helpful? 0
  • +
  • -

#9 przemass  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 166
  • Joined: 18-July 09

Re: Mail function doesn't work

Posted 25 August 2009 - 03:56 AM

You have to install SMTP Server, try looking in google for it http://www.google.co...ree+smtp+server
Was This Post Helpful? 0
  • +
  • -

#10 codemaker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 25-July 09

Re: Mail function doesn't work

Posted 25 August 2009 - 05:08 AM

Thanks guys for all the replies. Actually, I tried that script yesterday and I received nothing. I tried to send emails to my yahoo and gmail accounts but like I said I got nothing. I checked my inbox at yahoo and gmail today, I received all the emails I sent yesterday. I tried again and sent emails today to yahoo and gmail and I received them instantly.

Any ideas what may caused that. By the way I run fedora 11 on my computer.

Thanks
Was This Post Helpful? 0
  • +
  • -

#11 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 900
  • Joined: 08-August 08

Re: Mail function doesn't work

Posted 25 August 2009 - 07:45 AM

might just have got caught up a little bit. i dont know how it works but ive had to wait several hours for email before, it just happens every so often.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1