PDA

View Full Version : php email



nate51
05-02-2008, 02:26 PM
I am using a flash form and when 'send' is hit it communicates with a php page which then sends me an email with the contents of the message, senders email and name.

Everything works........ kind of, but I am getting this string of code in my email.

<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"10\" COLOR=\"#333333\" LETTERSPACING=\"0\" KERNING=\"0\">Message content</FONT></P></TEXTFORMAT>

As you can see "Message Content" is all I want but it's like it is shooting over an html markup which isnt in my flash file or in the php.

php code is as follows.


<?php

$sendTo = "xxxx@xxxxxx.com";
$subject = "Comment";

$headers = "From: " . $_POST["email"] ."\r\n";

$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$headers .= "Return-path: " . $_POST["email"];

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

?>

The only thing that displays right is the Subject, even the reply address (senders email) does display, but again with that html mark up so when you hit reply I get there email address but then the html code after it. And it's long.

Anyone got anything like this before and were able to solve it?


-- Nate :(

Medyman
05-02-2008, 02:30 PM
1. You should check to see if your textfield in Flash is set to parse HTML. That might be a cause of your problems.

2. Wrap the variables with strip_tags() (http://us2.php.net/strip-tags) and see if that makes any difference

nate51
05-05-2008, 06:24 PM
ok setting flash to parse HTML I have no idea what that means or how to do it, but I would imagine that is not the problem as data is getting from my flash file to my email.

As for the strip_tags() I looked into the document and I think I did what they were describing but it messed everything up and stop sending emails.

The only thing I found makes a diff is if I drop these lines into the php.

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


I found doing this brought the message to me without the html tags wrapping around the message, problem though is it seems to be cancelling out the other two headers.

$headers = "From: " . $_POST["name"] ."<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

So the email arrives labeled as "CGI-Mailer" the subject is still fine but the reply address and name are gone, so I added this to the message section.

$message = "From: " . $_POST["name"] ." " . $_POST["email"] ." " . $_POST["message"] ."\r\n";

So that I can get the persons name and email address to reply to them.

I'm just confused because I have used this before and it didn't give me any problems. Is there someway to make all the 4 headers I have described work together instead of cencelling each other out?

ReadyToLearn
05-05-2008, 08:06 PM
That's because you're resetting the headers by not concatinating to what you already have.

The headers should look like this (notice the equal sign):


$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: " . $_POST["name"] ."<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

nate51
05-06-2008, 12:37 PM
I just tried it again with the change posted by "ReadyToLearn" and the message content shows up properly now but the reply address still is coming in like this.

John Doe jdoe@email.com > [TEXTFORMAT LEADING=\"2\"P ALIGN=\"LEFT\"FONT FACE=\"Arial\" SIZE=\"10\" COLOR=\"#353C53\" LETTERSPACING=\"0\" KERNING=\"0\"/FONT/P/TEXTFORMAT<TEXTFORMAT LEADING=\"2\"P ALIGN=\"LEFT\"FONT FACE=\"Arial\" SIZE=\"10\" COLOR=\"#333333\" LETTERSPACING=\"0\" KERNING=\"0\"/FONT/P/TEXTFORMAT]

I don't know where to go from here this is kind of bizzar to me.

boogyman
05-06-2008, 01:14 PM
can you show us the code.. showing us the output only doesnt help

nate51
05-07-2008, 03:48 AM
The code for the php is as follows...

<?php

$sendTo = "xxxx@xxxxx.com";
$subject = "Inquiry/Comment";

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: " . $_POST["name"] ."<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$message = "From: " . $_POST["name"] ." " . $_POST["email"] ." " . $_POST["message"] ."\r\n";

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

?>

The code for the send button...

on(release) {
form.loadVariables("sendmail.php", "POST");
}

Then this AS is in the MC which contains the text fields...

onClipEvent(data){
nextFrame();
}

nate51
05-12-2008, 08:13 PM
Anyone able to help me out on this one?

I am not running into a problem where I hit send and nothing happens, I get no email now and the firm does not jump to the next frame to indicate to the user their info has been submitted. it just sits there now.

I'm just really lost here.

nate51
05-12-2008, 08:25 PM
* Corr emails are getting through now it was a problem with my ISP. Problem solved, no need for help with this one.