2 Replies Latest reply on Apr 7, 2009 4:32 PM by GumpsterF

    I have a problem with a formmail

    armandix Level 1


         
      I created a whole site in flash and i make a contact form but when I upload the site to the server, the form is not send to the email.
      The site is hosted in hostenet they have some problems with flash and php, does anyone could help me.
      the email where i send formmail does not belong to hostenet.
      this is the code for  flash:

       

      btenvio.onRelease = function ()
      {
         
          var _loc2 = new LoadVars();
          _loc2.nome = nome.text;
          _loc2.email = email.text;
          _loc2.telefone = telefone.text;
          _loc2.assunto = assunto.text;
          _loc2.mensagem = mensagem.text;
          _loc2.destinatario = "armandoferr@gmail.com";
          _loc2.onLoad = function (success)
          {
              if (success)
              {
                  nome.text = "";
                  email.text = "";
                  assunto.text = "";
                  telefone.text= "";
                  mensagem.text = "";
                  mcMsg.mcTxt.txtMsg.text = this.controllo;
              } // end if
          };
          _loc2.sendAndLoad("paginas_swf/email.php", _loc2, "POST");
          gotoAndPlay(2);
      };

       

      And this for the php:

       

      <?
      $nome = $_POST["nome"];
      $email = $_POST["email"];
      $assunto = $_POST["assunto"];
      $msg = $_POST["msg"];

       

      $para = "armandoferrar@gmail.com";

       

      $assunto_ar = "Contato HFPROJETUAL";

       

      $resposta = "
      <div align='center'>
      <font face='arial' size='2' color='#990000'>Auto-Resposta HFPROJETUAL/font><br><br>
      <font face='arial' size='2' color='#990000'>Obrigado por entrar em contato.</font><br><br><hr size='1' color='#990000'>
      </div>
      <font face='arial' size='2' color='#333333'><strong>SUA MENSAGEM:</strong></font>
      <hr size='1' color='#990000'>
      $msg
      <hr size='1' color='#990000'><br>
      <font face='arial' size='2' color='#333333'><strong>HF Projetual - Arquitetura e Decoração</strong></font><br><br>
      <div><img src='http://www.hfprojetual.com.br/imagens/logomail.jpg' width='250' height='92'></div><br>
      <font size='1' face='arial' color='#990000'>Por favor não responda. Esta é uma mensagem automática.</font>";
      $corpo = "<font color='#333333' face='arial' size='2'>Mensagem enviada por: <b>$nome</b><br><br>";
      $corpo .= "<font face='arial' size='2' color='#000000'>$msg</font>";
      $headers = "MIME-Version: 1.0\r\n";
      $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
      $headers .= "From: $email";
      $cabecalhos = "MIME-Version: 1.0\r\n";
      $cabecalhos .= "Content-type: text/html; charset=iso-8859-1\r\n";
      $cabecalhos .= "From: HF Projetual <$para>";
      mail ("$para","$assunto","$corpo","$headers");
      mail ("$email","$assunto_ar","$resposta","$cabecalhos");
      echo "&$sucesso=ok";
      ?>
      //

       

      help me please!!

        • 1. Re: I have a problem with a formmail
          Dan.Smith Level 2

          You might want to start checking with the host on their requirements for using formmail.  Some hosts have restrictions on who you can send from.

           

          Since you are using sendAndLoad, does it return any errors?

          • 2. Re: I have a problem with a formmail
            GumpsterF Level 1

            Dan.Smith is correct, check with your host first.

            For instance if you are using a goDaddy Windows server (whcih I know you are not), you need to add these two lines of code  at the beginning of your php code.

             

            ini_set('sendmail_from', 'user@domain.tld'); // Set only on Windows
            ini_set('SMTP', 'relay-hosting.secureserver.net');
            

            Your hosing service may have similar code you need to add in order to generate an email from their server. You need to contact them and ask I think.