Page 1 of 1

email posting engine not working?? - what is wrong?

Posted: Thu Mar 13, 2008 1:23 pm
by josh22x
Hey,

I have developed this basic email submission engine and it will not work. It keeps looping to the "Email did not submit!!!" echo statement.
Does anyone have any ideas why this will not work??

Here is the code:

<?php

$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$content = "($name) with an email of ($email) made the following comments on your site: ($comments)";

$test = mail('joshyoung@localhost', 'Contact Response', 'test');
print_r($test);

if ($test)
{
echo "Email was sent sucessfully";
}
else {
echo "Email did not submit!!!";
}
echo "<br></br>";
?>

Re: email posting engine not working?? - what is wrong?

Posted: Thu Mar 13, 2008 1:40 pm
by kryles
oh god I'm far from an expert in using localhost (I always use hosting services), but PHP uses port 25 and SMTP by default I think. SO check that you can use those. I think you can check your .ini for the php setting

I can also be very very wrong, but I thought I'd mention that (hopefully someone clears that up lol).

Re: email posting engine not working?? - what is wrong?

Posted: Thu Mar 13, 2008 9:20 pm
by josh22x
Actually, that should not be the problem because I had it set to a valid email address and it did the same thing!

Thanks...

Re: email posting engine not working?? - what is wrong?

Posted: Fri Mar 14, 2008 6:22 am
by kryles
oh wow, what a blonde moment.........I have used mail() a few times but when I saw localhost I just jumped to the conclusion you were running it off a local machine (my localhost wont let me set cookies or send mail).

errr, so yah I'm not sure sorry for misunderstanding your problem first time around =/

Re: email posting engine not working?? - what is wrong?

Posted: Fri Mar 14, 2008 11:22 am
by josh22x
Thanks for the help though....

Anybody else have any ideas??

Thanks
Josh