Joker7 schreef:
> Hi,
> I use the script below to send a email from a contact form but it would be
> nice if the conformed sent page showed what was sent.Question how can I do
> this ?
>
> Thanks
> Chris
>
> <?php
> $mailto = 'email@mail.co' ;
> $subject = "Feedback Form" ;
> $formurl = "http://page.co/ of form" ;
> $errorurl = "http://page.co/contact.php" ;
> $thankyouurl = "http://page.co/thankyou.php" ;
> $uself = 1;
> $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
> $name = $_POST['name'] ;
> $email = $_POST['email'] ;
> $comments = $_POST['comments'] ;
> $http_referrer = getenv( "HTTP_REFERER" );
>
> if (!isset($_POST['email'])) {
> header( "Location: $formurl" );
> exit ;
> }
> if (empty($name) || empty($email) || empty($comments)) {
> header( "Location: $errorurl" );
> exit ;
> }
> if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
> header( "Location: $errorurl" );
> exit ;
> }
>
> if (get_magic_quotes_gpc()) {
> $comments = stripslashes( $comments );
> }
>
> if (!strstr($_SERVER['HTTP_REFERER'], 'page.co')) { exit ("Invalid
> referrer");
>
> }
>
> $messageproper =
>
> "This message was sent from:\n" .
> "$http_referrer\n" .
> "------------------------------------------------------------\n" .
> "Name of sender: $name\n" .
> "Email of sender: $email\n" .
> "------------------------- COMMENTS -------------------------\n\n" .
> $comments .
> "\n\n------------------------------------------------------------\n" ;
>
> mail($mailto, $subject, $messageproper,
> "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" .
> $headersep . "X-Mailer: Feed Back" );
> header( "Location: $thankyouurl" );
> exit ;
>
> ?>
>
>
Hi,
http://nl2.php.net/manual/en/function.mail.php
says for returnvalue of your mail command:
Quote:
Return Values
Returns TRUE if the mail was successfully accepted for delivery, FALSE
otherwise.
It is important to note that just because the mail was accepted for
delivery, it does NOT mean the mail will actually reach the intended
destination.
|
So just change it in:
$mailresult = mail(..yourstuffhere..);
And then use the value for $mailresult to display if the sending was
succesful.
echo (($mailresult) ? "SUCCES!":"PROBLEM WITH SENDING" );
Regards,
Erwin Moller