Solved

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

Posted on 2007-11-16
10
300 Views
Last Modified: 2010-04-21
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

0
Comment
Question by:systems_mitsui
  • 5
  • 4
10 Comments
 
LVL 20

Expert Comment

by:steelseth12
ID: 20297208
<?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);
?>
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20297212
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

0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20297216
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
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:systems_mitsui
ID: 20297395
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?

0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20297567
<?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);



?>
0
 

Author Comment

by:systems_mitsui
ID: 20298315
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);



?>


0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20298392
You need to put the full path to the jpg e.g http://www.yoursite.com/top.jpg
0
 

Author Comment

by:systems_mitsui
ID: 20298550
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);



?>


0
 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 total points
ID: 20298606
if your ip is accessible from outside your local network then you should get a warning  in hotmail to enable restricted content or something like that.
If its not accessible from the outside then you will have to upload it to your server in order for it to work.

Go to http://www.007ihost.com/ and register a free account upload the image to the server
and put

<img src="http://yourusername.007ihost.com/top.jpg">
0
 

Author Closing Comment

by:systems_mitsui
ID: 31409524
Suberb, nice one!!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question