Php Form...help

He has: 4 posts

Joined: Nov 2003

Could you please tell me what Im doing wrong? The form seems to work fine but the e-mail is never sent.

Here is the form:
FORM
and:confused: the other part

Quote: Sendemail Script

<?php
                                                    $myemail
= "[email protected]";     if (!isset($visitormail))   echo "Somebody Goofed $ip" ;     $todayis = date("l, F j, Y, g:i a") ;    $subject = "Visitor Mail" ;    $message = " $todayis [EST] \n  Message: $notes \n   From: $visitor ($visitormail)\n  Additional Info : IP = $ip \n  Browser Info: $httpagent \n  Referral : $httpref \n  ";    $from = "From: $myemail\r\n";    if ($myemail != "")   mail($myemail, $subject, $message, $from);   
?>
Date:
<?php
echo $todayis
?>
Thank You :
<?php
echo $visitor
?>
(
<?php
echo $visitormail
?>
)
<?php
echo $ip
?>
Next Page

Busy's picture

He has: 6,151 posts

Joined: May 2001

try change $from in the mail tag to "From: $from\n" (changing the $form string to suit) and not sure you need the \r in it either

druagord's picture

He has: 335 posts

Joined: May 2003

first you should use code tags instead of quotes so that we can read your code easily.

i noticed that you use

if (!isset($visitormail))
'
to check if the input as been filled the problem with this is even "" is considered as set
if ($myemail != "") mail($myemail, $subject, $message, $from);
'
$myemail will always be set since it's the first thing you do on this page

try this and see what you get

if (mail($myemail, $subject, $message, $from))
   echo "good it seems to work";
else
   echo "something wrong";
'

did you check the mail server logs to see if it tried to send the mail

IF , ELSE , WHILE isn't that what life is all about

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

does doing something as simple as:

<?php
mail
(\"[email protected]\", \"Test Mailing\", \"This is a test of sending mail via PHP\n\");
?>

work? If not, the something may not be confirgured right on the server.

-Greg

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.