I am sure this is an embarrasing newbie question.
I have an email script which works fine if the data in the fields passed to it do not contain spaces.
I therefore urlencoded the data, but that sends all messages with a "+" symbol between all of the words.
What am I missing here? Please help.
<?php
if($sendemail)
{
$email=trim($frmail);
$sub=trim($subj);
$comments = urlencode($sub);
$sendername = urlencode($sender);
$phonenumber = urlencode($phone);
$header = "MIME-Version: 1.0\r\n";
$header.= "Content-type: text/html; charset=iso-8859-1\r\n";
$header.="From: ".$_POST['frmail']."\r\n";
if (!ereg("[a-zA-Z0-9_]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$", $email))
{
echo "That is not a valid email address. Please return to the"
." previous page and try again.";
exit;
}
$toaddress = "webcontact@***********"; // the default value
$allinfo = $comments.$sendername.$phonenumber;
$mailcontent = "From: ".$frmail."\r\n"."To: ".$toaddress."\r\n"."Subject: ".$comments."\r\n"
."User email: ".$email."\r\n"."other stuff".$allinfo;
$sendmessage = mail($toaddress, $comments, $mailcontent, $header, $allinfo);
}
?>