In AS3, If you want to send an email, all you have to do is this:

function sendData():void
{
??? var variables:URLVariables = new URLVariables();
??? variables.name = name_txt.text;
??? variables.email = email_txt.text;
??? variables.message = message_txt.text;

??? var _request:URLRequest = new URLRequest("mailer.php");

??? _request.data = variables;
??? _request.method = URLRequestMethod.POST;

??? var loader:URLLoader = new URLLoader();
??? loader.dataFormat = URLLoaderDataFormat.TEXT;
??? loader.addEventListener( Event.COMPLETE, sendComplete );
??? loader.load( _request );
}

function sendComplete( e:Event ):void
{
??? helpnotif_mc.helptip_txt.text = "Message Sent! We will reply asap!";
??? helpnotif_mc.helptip_txt.textColor = 0x00ff00;

}
 
 
-------------------------------------------------------------------------------------------------------------

PHP:::::::



<?php

/* mailer.php - version 1.0.1 */
/* creator - Jacob Relkin*/

/* Pull POST data from Flash */

$name = $_POST['name'];
$email = $_POST['email'];

/* Define html message */

$message = '<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP E-Mail</title>
<style type="text/css">
<!--
body,td,th {
??? font-family: Verdana, Arial, Helvetica, sans-serif;
??? font-size: 16px;
??? color: #00FF00;
}
body {
??? background-color: #000000;
}
-->
</style></head>

<body>
<div align="center">' . $_POST['message'] . '</div></body></html>';


/* Title of the E-mail */
$subject? = "PHPMessage";

/* The e-mail address to send the message to. */
$toaddress = '[EMAIL PROTECTED]';

$name = trim($name);
$email = trim($email);

$subject = stripslashes($subject);
$message = stripslashes($message);

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

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

?>

If you have any questions, you can email me at [EMAIL PROTECTED]

Jacob


 

-----Original Message-----
From: Lehr, Theodore M (N-SGIS) <[EMAIL PROTECTED]>
To: Flash Coders List <[email protected]>
Sent: Mon, 14 Apr 2008 11:29 am
Subject: [Flashcoders] sending email as/php










Sorry for posting such a basic but I did google first... I am trying:

 

As: 

 

loadVariablesNum ("mail.php", 0, "POST");

 

php:

<?php

 

            $comment=$_GET['ucomment'];

            $name=$_GET['uname'];

            $email=$_GET['uemail'];

 

            mail("[EMAIL PROTECTED]", "subject", "Name: ".$name."\nEmail:
".$email."\n\nComment: ".$comment);

?>

 

I am not getting the variable values...

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



 

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to