Hi. My flash form that uses a php mail script is sending the text formatting along with the data making it impossible to read. How can I strip all the formatting and just have the data left over in a readable format?

Here is how the email looks:

Name : <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"11\" COLOR=\"#FFFFFF\" LETTERSPACING=\"0\" KERNING=\"0\">Scott JAcque</FONT></P></TEXTFORMAT>

Email: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"11\" COLOR=\"#FFFFFF\" LETTERSPACING=\"0\" KERNING=\"0\">none@none.com</FONT></P></TEXTFORMAT>

Comments: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"JUSTIFY\"><FONT FACE=\"Arial\" SIZE=\"11\" COLOR=\"#FFFFFF\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"11\" COLOR=\"#FFFFFF\" LETTERSPACING=\"0\" KERNING=\"0\">Hello, please work</FONT></P></TEXTFORMAT>

Here is the script:

$destination="none@none.com;
$name=$_POST;
$email=$_POST;
$mes=$_POST;
$mes=$_POST;
$mes=$_POST;
$subject="Message from $name" ;
$mes="Name : $name\n
Email: $email\n
Comments: $mes\n";
mail($destination,$subject,$mes); ?>

why don't you just use an html email, right now its only sending as a text.

why don't you just use an html email, right now its only sending as a text.

I'm willing to do it whatever way I need. I don' care how it comes out in the email as long as I can read it. Can you give me an example of what I need to do to the script to send an html email?

Thanks

Scott

here is an html email php code:

$to = 'none@none.com';
$name = $_REQUEST['name1'];
$subject = 'Message from ' . $name;
$email = $_REQUEST['email'];
$company = $_REQUEST['company'];
$number = $_REQUEST['number'];
$comments = $_REQUEST['comments'];
$message = <<<EOF
<html>
<body>
<table border="0">
<tr>
<td>Name:</td>
<td>$name</td>
</tr>
<tr>
<td>Email:</td>
<td>$email</td>
</tr>
<tr>
<td>Company:</td>
<td>$company</td>
</tr>
<tr>
<td>Number:</td>
<td>$number</td>
</tr>
<tr>
<td>Comments:</td>
<td>$comments</td>
</tr>
</table>
</body>
</html>
EOF;
$headers  = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$mail = mail($to, $subject, $message, $headers);
}
}
}
}

Thanks for taking the time to write that up. Unfortunately for some reason it didn't work when I uploaded it to the server. The only changes I made was put in a valid email address. Any ideas?

Thanks

Scott

try this:

<?php
$to = 'none@none.com';
$name = $_REQUEST['name1'];
$subject = 'Message from ' . $name;
$email = $_REQUEST['email'];
$company = $_REQUEST['company'];
$number = $_REQUEST['number'];
$comments = $_REQUEST['comments'];
$message = <<<EOF
<html>
<body>
<table border="0">
<tr>
<td>Name:</td>
<td>$name</td>
</tr>
<tr>
<td>Email:</td>
<td>$email</td>
</tr>
<tr>
<td>Company:</td>
<td>$company</td>
</tr>
<tr>
<td>Number:</td>
<td>$number</td>
</tr>
<tr>
<td>Comments:</td>
<td>$comments</td>
</tr>
</table>
</body>
</html>
EOF;
$headers  = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$mail = mail($to, $subject, $message, $headers);
if (!$mail) {
echo "Mail not sent";
}
else {
echo "Mail sent";
}
?>

Wow, that was fast. I'll test it this morning.

On another note, I'm using POST to gather variables from the flash form. Does your script take that in to condiseration or does it matter?

Thanks

Scott

Nice work. I got it working for the most part. The only problem left is the 'Subject' header in the email is still posting like this.

Message from <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"11\" COLOR=\"#FFFFFF\" LETTERSPACING=\"0\" KERNING=\"0\">Scott Knell</FONT></P></TEXTFORMAT>

Anyway to get rid of the formatting on the subject line?

Thanks a ton

Scott

the flash form is send the formatting with the text it submits to the php. i have no idea what to in this case because i have NO experience in flash. i've always been interested in it but i've never used it at all. does the form need to be flash? i can type you up a new one that will work and not send all the extra information.

Keith,

It is all working now. I had to make some changes to your script. I'll post it for you so if you want to keep it for future use in Flash you can. I hard coded the subject line to get rid of the formatting text.

Thanks again for your help.

Scott

<?php
$to = 'none@none.com';
$name = $_POST;
$subject = 'Kim & Steve RSVP';
$email = $_POST;
$message = $_POST;
$attend = $_POST;
$guests = $_POST;
$message = <<<EOF
<html>
<body>
<table border="0">
<tr>
<td>Name:</td>
<td>$name</td>
</tr>
<tr>
<td>Email:</td>
<td>$email</td>
</tr>
<tr>
<td>Attend:</td>
<td>$attend</td>
</tr>
<tr>
<td>Guests:</td>
<td>$guests</td>
</tr>
<tr>
<td>Message:</td>
<td>$message</td>
</tr>
</table>
</body>
</html>
EOF;
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
mail($to, $subject, $message, $headers);
if (!$mail) {
echo "Mail not sent";
}
else {
echo "Mail sent";
}
?>

It took me days to figure this out, and finally I decided to call someone who knew the answer.

Get rid of any html tags, in PHP, using strip_tags.

<?php
$to = 'email@domain.com';
$name = $_POST;
$name = strip_tags($name);
$subject = $_POST;
$subject = strip_tags($subject);
$email = $_POST;
$email = strip_tags($email);
$message = $_POST;
$message = strip_tags($message);

So first you get the variable from Flash. That is the one after POST.
Then you use striptags on your PHP variable, with the $.

... the rest can be done just like it's done on this thread.

cvvvvvvvvvvvvv

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.