0 Replies Latest reply on Apr 7, 2008 9:06 AM by skarab

    Flash form to email not loading message body

    skarab
      I'm creating a form in Flash for a client's website to make online reservations. I've been experimenting with asp scripts and found two that work fine, except that the body of the email won't load. The emails come through fine, but blank.
      Since it's the same with both asp scripts I suspect the prob is in the AS but I've been looking at this and tweaking and experimenting for four days now. Any help will be appreciated.

      Here's one of the asp scripts:

      <%
      strToEmail = "gmooney@fakeemail.com"
      strToName = "Gerry Mooney"
      strToSubject = "LPReservation Request-tomailscript"

      Set Mailer = Server.CreateObject("CDO.Message")
      'Mailer.RemoteHost = "mail.yourdomain.com"


      strName = Request.form("name")
      strEmail = Request.form("fromEmail_txt")
      strMesg = Request.form("firmName_txt")
      strBody = strMesg

      'Mailer.FromName = strName
      Mailer.FromAddress = strEmail
      'Mailer.AddRecipient strToName, strToEmail
      Mailer.Subject = (strToSubject)
      Mailer.BodyText = strMesg

      if Mailer.SendMail then
      Response.Write "_root.status_txt.text=Your message has been sent. Thank you."
      else
      Response.Write "_root.status_txt.text=Error: Fail to sent your message."
      Response.Write Mailer.Response
      end if
      %>


      And here's the AS:

      var email_lv:LoadVars = new LoadVars();

      //this function is called when email_lv loads the server-side script.
      email_lv.onLoad = function(success) {
      //If the script was successfully loaded, this condition is run
      if (success) {
      /* Though the server-side script was loaded, it does not mean it was
      executed successfully. This condition gets a response from the
      server-side script and determines if it was truly successful. */
      if (this.server_mes == "ok") {
      status_txt.text = "Email Sent";
      /* You can add additional code here. This is only run
      if everything went as planned. */
      }
      } else {
      //email failed to send, but script did load. Likely a server issue.
      status_txt.text = "Email Failed";
      }
      };

      /*This is the onRelease function for "submit_btn" button. This is only run
      if the button was pressed. */
      submit_btn.onRelease = function() {
      /* Here we are validating the data. This insures the email address contains
      both the "@" and ".", If not, it stops the script and alerts the user. */
      if (!fromEmail_txt.length || fromEmail_txt.indexOf("@") == -1 || fromEmail_txt.indexOf(".") == -1) {
      status_txt.text = "Invalid Email";

      //This validates the subject line contains text
      } else if (!subject_txt.length) {
      status_txt.text = "Missing Subject";

      //This validates the message body contains text
      } else if (!firmName_txt.length) {
      status_txt.text = "Missing Firm Name";

      //This validates the check in date
      } else if (!checkIn_txt.length) {
      status_txt.text = "Missing Check-in Date";

      //If everything is filled out correctly, this is run.
      } else {
      //Collects the data from the text boxes and gives it to email_lv
      email_lv.fromEmail_txt = fromEmail_txt.text;
      email_lv.subject_txt = subject_txt.text;
      email_lv.firmName_txt = firmName_txt.text;
      email_lv.checkIn_txt = checkIn_txt.text;


      /* Finally, send the data to the server and get a response.
      As mentioned above, serverlang holds the file extendion for
      the server side language. You can hard code the complete file name. */
      email_lv.sendAndLoad("tomail_mytest.asp", email_lv, "POST");
      }
      };


      Any suggestions will be appreciated. Thanks!