|
From: Victor Fdez-Peñaranda on 15 May 2006 07:49 Hello friends, I need to send a mail using a form from flash that calls an asp file. I have created some input textbox with their variables (txtName, txtFrom, txtEmpresa, txtMessage) and a send button with the following action: on (release) { if (txtFrom ne "" & txtName ne"") { loadVariablesNum("envio.asp", 0, "POST"); gotoAndPlay(2); } else { stop(); } } also tried with: on (release) { if (txtFrom ne "" & txtName ne"") { loadVariablesNum("envio.asp", 0); gotoAndPlay(2); } else { stop(); } } Then I have code my own asp, that is located in the same folder. This is my asp code: <% <!-- ENVIO DE MENSAJE --> strHost = "smtp.rauroszm.com" empresa = Request.form("txtEmpresa") Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = strHost strBody = "Mensaje generado por:" & request.form("txtName") chr(10) & chr(10) strBody = strBody & request.form("txtMessage") & chr(10) strBody = strBody & " " & chr(10) & chr(10) strBody = strBody & " Pertenece a la empresa" & request.Form("txtEmpresa") & chr(10) Mail.From = Request.form("txtFrom") Mail.FromName = Request.form("txtName") Mail.AddAddress "prueba(a)rauroszm.com" Mail.Subject = "Consulta desde la web" Mail.Body = strBody On Error Resume Next Mail.Send Set Mail = Nothing %> But it doesn´t work and have no idea why. Your help will be much appreciated. Regard, Victor.
From: kevinsweeney on 15 May 2006 11:06 the new way to send variables through flash is with the LoadVars class. to do this... // create a new LoadVars object to send var myFormSender:LoadVars = new LoadVars(); // create a new LoadVars object to do something once a response is determined var myFormSent:LoadVars = new LoadVars(); // when the submit button is released.. my_btn.onRelease = function():Void { // get the value of your input fields and set them as properties of your LoadVars object myFormSender.theName = txtName.text; myFormSender.theEmail = txtEmail.text; myFormSender.theMessage = txtMsg.text; // then send everything contained in the LoadVars object (all the properties we just assigned) to the script on the server. // set the mail function to a variable so that if that mail send function was successful, it prints out a name/value variable pair for Flash to read like "msgSent=OK" // We then use the sendAndLoad method to send out data to the script, and then load any variables that script contains (the msgSent one you just created) into the myFormSent LoadVars we created earlier myForm.sendAndLoad("contact_form.asp", myFormSent, "post"); }; // now we listen for a response myFormSent.onLoad = function():Void { // if the script returned the variable msgSent and that was equal to "OK", then go to a frame to inform user of the successful operation if(this.msgSent == "OK") { gotoAndPlay(2); } };
From: Victor Fdez-Peñaranda on 17 May 2006 04:04 Hello kevin, Very good post. Thanks a lot for your reply. Regards,
|
Pages: 1 Prev: Press "spacebar....." Next: Unable to authenticate installer |