Envoyer un mail avec PHP de flash
Bonjour,
C'est là un sujet abondamment discuter dans tous les sites traitant de flash mais personne n'a l'a l'air de connaître la solution.
J'ai un formulaire sur un .SWF qui envoie le contenu des textbox dans un script .PHP qui à son tour envoie le email. Malgré plusiers heures de travail, je n'y arrive pas.
Avez-vous des suggestions?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| stop();
var senderLoad:LoadVars = new LoadVars;
var receiveLoad:LoadVars = new LoadVars;
sender.onRelease = function()
{
senderLoad.theName = theName.text;
senderLoad.theTelephone = theTelephone.text;
senderLoad.theEmail = theEmail.text;
senderLoad.theMessage = theMessage.text;
senderLoad.theRegion = theRegion.text;
senderLoad.theType = theType.text;
senderLoad.theRoom = theRoom.value;
senderLoad.theBathroom = theBathroom.value;
senderLoad.theFireplace = theFireplace.value;
senderLoad.thePool = thePool.value;
senderLoad.theGarage = theGarage.value;
senderLoad.theShore = theShore.value;
senderLoad.sendAndLoad("http://www.jessicagoyette.com/flash/form.php",receiveLoad,"POST");
}
receiveLoad.onLoad = function()
{
if (this.sentOk)
{
_root.gotoAndStop("success");
}
else
{
_root.gotoAndStop("failed");
}
} |
.PHP
<?php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| $to = "mathieustephanie@sympatico.ca";
$subject = "Demande d'information";
$message = "Nom: " . $_POST["theName"];
$message .= "\nEmail: " . $_POST["theEmail"];
$message .= "\nTéléphone: " . $_POST["theTelephone"];
$message .= "\nRégion: " . $_POST["theRegion"];
$message .= "\nType de propriété: " . $_POST["theType"];
$message .= "\nNombre de chambres: " . $_POST["theRoom"];
$message .= "\nNombre de salles de bain: " . $_POST["theBathroom"];
$message .= "\nFoyer: " . $_POST["theFireplace"];
$message .= "\nPiscine: " . $_POST["thePool"];
$message .= "\nGarage: " . $_POST["theGarage"];
$message .= "\nBord de l'eau: " . $_POST["theShore"];
$message .= "\n\nCommentaires: " . $_POST["theMessage"];
$headers = "From: " . $_POST["theEmail"];
$headers .= "\nReply-To: " . $_POST["theEmail"];
$sentOk = mail($to,$subject,$message,$headers);
echo "sentOk=" . $sentOk;
?> |