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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
josh22x
Forum Commoner
Posts: 38
Joined: Tue Feb 26, 2008 11:17 am

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

Post 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>";
?>
kryles
Forum Contributor
Posts: 114
Joined: Fri Feb 01, 2008 7:52 am

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

Post 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).
josh22x
Forum Commoner
Posts: 38
Joined: Tue Feb 26, 2008 11:17 am

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

Post 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...
kryles
Forum Contributor
Posts: 114
Joined: Fri Feb 01, 2008 7:52 am

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

Post 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 =/
josh22x
Forum Commoner
Posts: 38
Joined: Tue Feb 26, 2008 11:17 am

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

Post by josh22x »

Thanks for the help though....

Anybody else have any ideas??

Thanks
Josh
Post Reply