php not sending mail

They have: 12 posts

Joined: Jan 2006

I have recently started dabbling in php forms and can get a thank you
page showing, but the emails never get sent out. I'm using ready made
script from sitewizzard to do this. Any comment appreciated

Paul

He has: 52 posts

Joined: Apr 2006

Make sure that what/whoever is hosting you has PHP enabled and is configured correctly.

(PHP mail vars)

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Are you running the script on a local server or a remote web server?

I know PHP emails don't work on my local test server because my ISP won't let any servers but their own send outgoing email.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

See if you can do a very basic e-mail, try:

<?php
  $to
= \"[email protected]\";  // Change this to your e-mail address
 
$subject = \"Test Messsage\";
 
$body = \"This is the body of the e-mail.\";
 
  if (mail(
$to,$subject,$body))
     echo \"Message accepted.\n\";
  else
     echo \"Message rejected.\n\";

?>

For more information, see http://www.php.net/manual/en/function.mail.php

-Greg

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

And remember with Greg's script, just because it says "Message accepted." doesn't mean it's working. That would mean that there is nothing wrong with the script itself, though.

They have: 12 posts

Joined: Jan 2006

Yeah. Thanks for above.
Greg K; tried your script and got 'message accepted' but no mail sent so I must assume my web host doesn't support it. From another source I have discovered that
just because your web host is php ennabled it doesn't mean they allow you to send email.
Timjpriebe; must show my ignorance and confess I don't know the difference between
a local or remote web server. To me they are just a web host.
As for your ISP not allowing any mail to be sent other than from themselves, I didn't
think it had anything to do with them. I thought it was sent directly from your web host when it comes from a form on your website.
thanks again

Paul

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

By local, I meant it's at your house or place of business. On the same network (LAN) as your computer. And by remote, I meant it's off somewhere else. It sounds like it's remote.

And you're correct. When it is a remote web host, your ISP has nothing to do with it at all.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.