Flash/PHP Mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sleepydad
Forum Commoner
Posts: 75
Joined: Thu Feb 21, 2008 2:16 pm

Flash/PHP Mail

Post by sleepydad »

Hi all -

I have a designed a Flash based interface to send email via PHP.

I capture the variables in Flash using:

Code: Select all

var my_lv:LoadVars=new LoadVars();
my_lv.name=name_txt.text;
my_lv.message=message_txt.text;
// ...
// ...
my_lv.send("mail.php","POST");
 
My PHP reads:
 
<?php
 
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["from"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["from"] . "\r\n";
$headers .= "Return-Path: " . $_POST["from"];
 
$to = $_POST['to'];
$message=stripslashes($_POST['message']);
//NOTE: I tried $message without stripslashes - same results
$subject=stripslashes($_POST['subject']);
mail($to, $subject, $message, $headers);
 
?>
 
Everything is working fine, but when the message is received all line breaks entered in Flash message field are deleted making the message one long line. Is there something I need to write into my actionscript/php to allow the message to display properly (including manual line breaks)? I'm guessing (hoping!) it's an easy fix.

Thanks in advance -
sleepydad
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Flash/PHP Mail

Post by Jonah Bron »

Post Reply