Solved

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

Posted on 2007-11-16
10
297 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
 

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A Change in PHP Behavior with Session Write Short Circuit (http://php.net/manual/en/book.session.php#116217) (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now