Un Saluto a tutti,
Sono nuovo in questo forum e un principiante per quanto riguarda flash.
Il mio problema nasce dal fatto che dopo tanto tempo ho deciso di creare da solo un sito per la mia azienda. Il sito dopo tante difficoltà e seguendo varie guide è stato un successo con un unico problema:
il modulo di richiesta info che ho inserito (il mio dominio è su Aruba) non funziona, ael senso che non mi arriva nessuna email.
Non riesco a capire quale sia l'errore che commetto e vorrei un aiuto in tal senso. Nonostante varie guide e tutorial non sono riuscito a risolvere il problema.
Ecco il codice as3 e quello php che ho realizzato seguendo tutorial a gogo qui di seguito.
Grazie per la vostra disponibilità.
ps. il file flash e quello php sono pubblicati nella stessa directory di aruba quella principale del sito.
pagina flash
nome.tabIndex = 1
cognome.tabIndex = 2
indirizzo.tabIndex = 3
telefono.tabIndex = 4
email.tabIndex = 5
messaggio.tabIndex = 6
function resetta(evt){
nome.text = cognome.text = indirizzo.text = telefono.text = email.text = messaggio.text = ""
}
reimposta.addEventListener(MouseEvent.CLICK,resett a)
var variables:URLVariables = new URLVariables;
var varSend:URLRequest = new URLRequest("form.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event):void {
nome.text = "";
cognome.text = "";
indirizzo.text = "";
telefono.text = "";
email.text = "";
messaggio.text = "";
status_txt.text = event.target.data.return_msg;
}
invia.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend (event:MouseEvent):void {
if(!nome.length) {
status_txt.text = "Attenzione! campo nome non compilato";
} else if (!cognome.length) {
status_txt.text = "Attenzione! Cognome non inserito";
} else if (!indirizzo.length) {
status_txt.text = "Attenzione! Indirizzo non inserito";
} else if (!telefono.length) {
status_txt.text = "Attenzione! Recapito telefonico obbligatorio";
} else if (!messaggio.length) {
status_txt.text = "Attenzione! Nessuna richiesta/messaggio presenti";
} else {
variables.userNome=nome.text;
variables.userCognome=cognome.text;
variables.userIndirizzo=indirizzo.text;
variables.userTelefono=telefono.text;
variables.userEmail=email.text;
variables.userMessaggio=messaggio.text;
varLoader.load(varSend);
}
}
pagina php
<?php
$senderNome = $_POST["userNome"];
$senderCognome = $_POST["userCognome"];
$senderIndirizzo = $_POST["userIndirizzo"];
$senderTelefono = $_POST["userTelefono"];
$senderEmail = $_POST["userEmail"];
$senderMessagio = $_POST["userMessaggio"];
$to = "mia email";
$from = "$senderCognome";
$subject = "Richiesta informazioni da modulo sito";
// Modify the Body of the message however you like
$messaggio = $_POST["userMessaggio"];
// Build $headers Variable
$headers = "From: " . $_POST["UserNome"] ." ". $_POST["UserCognome"] . "<" . $_POST["UserEmail"] ."><" . $_POST["UserIndirizzo"] .">\r\n";
$headers .= "Reply-To: " . $_POST["userEmail"] . "\r\n";
$headers .= "Return-path: " . $_POST["userEmail"];
$to = "$to";
mail($to, $subject, $messaggio, $headers);
$my_msg = "Grazie la richiesta è stata inviata con successo.";
print "return_msg=$my_msg";
exit();
?>