Link to home
Start Free TrialLog in
Avatar of systems_mitsui
systems_mitsui

asked on

Problem with Flash/Php mail form:body of mail showing formatting

Hi all.

I kinda have a mail form working in flash, however when the e-mail turns up in my hotmail account, the body of the e-mail show the text formatting of the input boxes in flash

Here is what I get in my e-mail. Also the tel varible does not appear/please see php below this

<P ALIGN="LEFT"><FONT FACE="Myriad Pro" SIZE="14" COLOR="#B20606" LETTERSPACING="0" KERNING="0"></FONT></P><P ALIGN="LEFT"><FONT FACE="Myriad Pro" SIZE="14" COLOR="#B20606" LETTERSPACING="0" KERNING="0">This is a test of the work varible box</FONT></P>

<P ALIGN="LEFT"><FONT FACE="Myriad Pro" SIZE="14" COLOR="#B20606" LETTERSPACING="0" KERNING="0">This is a test of the name varible box,Darren</FONT></P>


<?php

$sendTo = "jonesdarren33@yahoo.com";
$subject = "Web Factory Site Reply";
$name = $_POST["name"];
$work = $_POST["work"];
$tel = $_POST["tel"];
mail($sendTo, $subject, $name, $work, $tel);
?>

How can I have the name, work and tel varible appear in the body of the e-mail without all the formatting? At the mo only the WORK and NAME varible are appearing within the formatting. I also want to add another varible called email, that I want to appear in the body, how do I add additional varibles to the body of the e-mail?

Can someone point out what I'm doing wrong in flash/php
In Flash:
Input text boxes have NOT been renderdd as HTML. Also tried with them rendered but no difference.
Fonts in  the input boxes have been embded as the contact form loads into a target movie clip that is masked, although I believe it's the PHP that is causing the formating problem?
B.T.W. :
Input text boxes in flash have the varibles: name, work, tel

Any help on this would be appricated

Avatar of steelseth12
steelseth12
Flag of Cyprus image

<?php

$sendTo = "jonesdarren33@yahoo.com";
$subject = "Web Factory Site Reply";
$name = $_POST["name"];
$work = $_POST["work"];
$tel = $_POST["tel"];
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


$body = $name.$work.$tel;

mail($sendTo, $subject, $body, $headers);
?>
Avatar of Joe Wu
Try the following see if it works, basically you put in the message variable all the formatting you want for your email message body.
<?php
 
$sendTo = "jonesdarren33@yahoo.com";
$subject = "Web Factory Site Reply";
$name = $_POST["name"];
$work = $_POST["work"];
$tel = $_POST["tel"];
$message = $name . "<br>" . $work . "<br>" . $tel;
mail($sendTo, $subject, $message);
?> 

Open in new window

the mail function takes 4 arguments .... email , subject , body , header

You need to specify in the header that you want to send an html email so that you get the formating and not the code.

Have a look at http://www.php.net/manual/en/function.mail.php
Avatar of systems_mitsui
systems_mitsui

ASKER

Hi nizsmo/steelseth12;

Great work, took both of your advice and now got it working.
Just a few questions. The font is appearing as formatted in Flash; 12 point, in red. Ok for the contact form in flash, but can I change the size & colour for when it arrives in the email. Is there a way to change the php so the fonts are formatted say, to Arial black, 10?

Also, is there a way to put a j-peg/gif in the body of the mail, so it appears above the first header. I want to insert a logo.
Any ideas on how I would do that. I take it I would have the logo say, called logo.jpg in the same directory as the other files but would I need to add something to the code of the submit btn in flash or the php file?

<?php

$sendTo = "jonesdarren33@yahoo.com";
$subject = "Web Factory Site Reply";
$name = strip_tags($_POST["name"]);
$work = strip_tags($_POST["work"]);
$tel = strip_tags($_POST["tel"]);
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";




$body = <<<EOT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Page Title</title>
<style>
body {font-family:Arial; font-size:10px; color:#000000;}
</style>
</head>

<body>
<p> <img src="http://www.yoursite.com/logo.jpg"> </p>
<p> $name </p>
<p> $work </p>
<p> $tel </p>


</body>
</html>

EOT;


mail($sendTo, $subject, $body, $headers);



?>
Hi, thank you for your excellent reply,

the formatting has worked, although where the jpg should be I have the symbol for an image.
not a red cross in a box that suggests broken path. I right clicked on the image square and selected show picture but nothing happened. I'm wondering if my hotmail account has limits on showing image?

Here is the php file I now have. Once again, thanks for you response.

B.T.W. top.jpg is in the same dir. as the php and flash html files.

<?php

$sendTo = "jonesdarren33@yahoo.com";
$subject = "Web Factory Site Reply";
$name = strip_tags($_POST["name"]);
$work = strip_tags($_POST["work"]);
$tel = strip_tags($_POST["tel"]);
$email = strip_tags($_POST["email"]);
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";




$body = <<<EOT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Page Title</title>
<style>
body {font-family:Arial; font-size:10px; color:#000000;}
</style>
</head>

<body>
<p> <img src="top.jpg"> </p>
<p> $name </p>
<p> $work </p>
<p> $tel </p>
<p> $email </p>

</body>
</html>

EOT;


mail($sendTo, $subject, $body, $headers);



?>


You need to put the full path to the jpg e.g http://www.yoursite.com/top.jpg
Hi bud, I am testing internally and do not have a FQDN so put the id address of the server followed by the image name i.e.

<p> <img src="http://10.96.161.9/top.jpg"> </p>

It appears in the browser, when I browse to it, however when I test, the email deosn't come through.

PHP file:

<?php

$sendTo = "jonesdarren33@yahoo.com";
$subject = "Web Factory Site Reply";
$name = strip_tags($_POST["name"]);
$work = strip_tags($_POST["work"]);
$tel = strip_tags($_POST["tel"]);
$email = strip_tags($_POST["email"]);
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";




$body = <<<EOT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Page Title</title>
<style>
body {font-family:Arial; font-size:10px; color:#000000;}
</style>
</head>

<body>
<p> <img src="http://10.96.161.9/top.jpg"> </p>
<p> $name </p>
<p> $work </p>
<p> $tel </p>
<p> $email </p>

</body>
</html>

EOT;


mail($sendTo, $subject, $body, $headers);



?>


ASKER CERTIFIED SOLUTION
Avatar of steelseth12
steelseth12
Flag of Cyprus image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Suberb, nice one!!!!