Here is the code with suggestion added, message still gets truncated after comma.

Ben

<?

include( "common.inc" );

$db = open_db();

html_header( "Contact Us" );

if(isset($doit))
{
$errors=array();

check_email( $email, $errors );

if(!isset ($message) || $message == '')
{
array_push($errors, "Message was empty");
}

if(sizeof($errors))
{
include($SESSION["libdir"] . "/show_errors.inc");
}
else
{

$admin_email =
"\"".lookup_domain( "PARAMETERS", "ADMIN_NAME", $db )."\" <".
lookup_domain( "PARAMETERS", "ADMIN_EMAIL", $db ).">";

if(!isset($subject)) {
$subject = "Message from email form on $SERVER_NAME";
}

table_top("Sending mail...");
table_middle();

$msg = trim( stripslashes( $_POST["message"] ) );

echo $msg;

mail( "$admin_email", "$subject", "$msg", "From: $email" );

echo "<center><span class=BigText><br><br>Your mail has been sent...<br><br>";
//echo redirect( $SESSION["homedir"]."/index.php", "Home Page", 3 );
echo "<br><br></span></center>";
table_bottom();
html_footer();
exit;
}
}

table_top("Contact Us");

//echo( "Contact Us" );

table_middle();

$admin_email = lookup_domain( "PARAMETERS", "ADMIN_EMAIL", $db );

?>

<center>
<br>
<b><span class=BigText>CultureShop.org, PO Box 29683, London E2 6XH</span></b>
<br><br><b>
To send us an email fill in this form and press submit</b><br><br>
<form method="post">
<input type=hidden name=doit value=1>
<b>Your Email Address:</b>
<br>
<input type="text" name="email" size=40 value="<?
if(isset($email)) { echo $email; }
?>">
<br><br>
<b>Subject:</b>
<br>
<input type=text name=subject size=40 value="<?
if(isset($subject)) { echo $subject; }
?>">
<br><br>
<b>Message:</b>
<br>
<textarea name="message" rows="10" cols="40"><?
if(isset($message)) { echo $message; }
?></textarea>
<br><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</form>
<br></center>

<?php

table_bottom();

html_footer();

close_db( $db );

?>

At 11:47 25/12/2002 -0800, Chris Wesley wrote:

On Wed, 25 Dec 2002, Ben Edwards wrote:

> I have a fairly simple mail form which gets email, subject and message and
> posts to itself.
> It then use mail() function to send a email.
> mail( $admin_email, $subject, $message, "From: $email" );
> Problem is the message gets truncated if there is a comma in the message
> after the comma.

I have forms that have identical functionality, but don't exhibit that
erroneous behavior.  I can't tell what you've done to the arguments to
mail() before using them, but the only thing I do is run them through
stripslashes() and trim().  i.e. -

$message = trim( stripslashes( $_POST['message'] ) );

If that's what you do too ... weird!  If not, give it a try and see what
happens.

        g.luck & cheers!
        ~Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
****************************************************************
* Ben Edwards                              +44 (0)117 9400 636 *
* Critical Site Builder    http://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video      http://www.videonetwork.org *
* Smashing the Corporate image       http://www.subvertise.org *
* Bristol Indymedia               http://bristol.indymedia.org *
* Bristol's radical news             http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8     *
****************************************************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to