3 Replies Latest reply on Aug 9, 2010 5:12 PM by wise_qwerty

    AMFPHP and Email

    djh88ukwb Level 1

      Hello all,

       

      Firstly is it possible to use AMFPHP to send emails ?

       

      At the moment i am using the following PHP script to send emails

      <?php
      $to = $_POST['senderemail'];
      $fname = $_POST['firstname'];
      $sname = $_POST['secondname'];
      $pass = $_POST['password'];

      $recipient = "$to";

      $headers = "From: test@test.com ";
      $subject = "Elizabeth Norman International Video Recruiter";
      $body = "Dear $fname $sname, \n You have now been registered in the Elizabeth Norman International Video Recruiter system. \n Your username is: $to \n Your password is: $pass \n A consultant will be in touch soon. \n \n";

      mail($recipient, $subject, $body, $headers)
      ?>

       

      This is a standalone php file on my server.  I would like to intergrate this into my AMFPHP services script file (the file that contains about 15 functions)

       

      Is it at all possible ?  If so could someone help ?

        • 1. Re: AMFPHP and Email
          rootsounds Level 4

          What happens on the server-side is completely independent. All Flex does is communicates through some interface that you have defined. You can have the PHP do whatever you want and Flex will be none the wiser (unless it's expecting some particular output).

          • 2. Re: AMFPHP and Email
            djh88ukwb Level 1

            Thanks for the reply.  Although i dont think i explained myself clearly.

             

            I have a AMFPHP service file, that is as follows

             

            <?php
            class jobs
            {
            var $db_host = '';
            var $db_name = '';
            var $db_user = '';
            var $db_pwd = '';


            function jobs()
            {
            $this->methodTable = array(
            "getJobs" => array(
            "description" => "Info Database",
            "access" => "remote"
            )
            );
            }

            function getAllJobs()
            {
            $mysql = mysql_connect($this->db_host, $this->db_user, $this->db_pwd);
            mysql_select_db( $this->db_name);
            $Query = "SELECT * from usernames WHERE level = 'clientuser'";
            $Result = mysql_query( $Query );
            return( $Result );
            }
            function getLinks()
            {
            $mysql = mysql_connect($this->db_host, $this->db_user, $this->db_pwd);
            mysql_select_db( $this->db_name);
            $Query = "SELECT * from link";
            $Result = mysql_query( $Query );
            return( $Result );
            }

            }
            ?>

             

            How would i go about adding this script to that set of functions

            <?php
            $to = $_POST['senderemail'];
            $fname = $_POST['firstname'];
            $sname = $_POST['secondname'];
            $pass = $_POST['password'];

            $recipient = "$to";

            $headers = "From: test@test.com ";
            $subject = "Elizabeth Norman International Video Recruiter";
            $body = "Dear $fname $sname, \n You have now been registered in the Elizabeth Norman International Video Recruiter system. \n Your username is: $to \n Your password is: $pass \n A consultant will be in touch soon. \n \n";

            mail($recipient, $subject, $body, $headers)

            ?>

             

            I have tried a few different things, but when i then upload the changed version, it corrupts the file so to speak and none of the functions work.

             

            Do you know how i could implement it ?

             

            Thanks

            • 3. Re: AMFPHP and Email
              wise_qwerty

              You can add this script like another function.

               

               

              function send_mail($data){
              $to = $_POST[$data['senderemail']];
              $fname = $_POST[$data['firstname']];
              
              
              .................
              mail($recipient, $subject, $body, $headers)
              
              }
              

               

              It's not a flex question, it's only about php.

               

              How did you upload the changed version?