Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2006
    Posts
    89

    Tiny help with an example

    I am starting a new thread for this repeat post because I am so close I am afraid it will get lost in the previous one.

    I am attaching an example of an am6 project that has the skeleton for everything I need except that I can not work out where in the am6 code I would place the address of the php mailer script on my server so that, when I click 'send', the on click event knows where to submit to.

    This example is from:

    http://www.indigorose.com/forums/showthread.php?p=75127

    and the php script on my server contains:

    <?php

    $mail_to = $_REQUEST['mail_to'];
    $subject = $_REQUEST['subject'];
    $message = $_REQUEST['message'];
    $mail_from = $_REQUEST['mail_from'];
    $reply_to = $_REQUEST['reply_to'];

    $headers = "From: $mail_from\r\n";
    $headers .= "Reply-To: $reply_to\r\n";
    $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
    $headers .= "Content-Transfer-Encoding: 7bit\r\n";

    mail(
    $mail_to,
    $subject,
    $message,
    $headers
    );

    ?>
    Attached Files

  2. #2
    Join Date
    May 2005
    Posts
    1,115
    I replied to you in your previous thread.

    For this one, try using $_POST in your php code instead of $_REQUEST
    Never know what life is gonna throw at you.
    (Based on a true story.)

  3. #3
    Join Date
    Feb 2006
    Posts
    89

    yes but......

    OK. But (and forgive me if this is daft and don't be afraid to tell me so); but how does AM6 know to submit the mail to http://www.karazoo.com/mailscript.php

    It is not entered anywhere in the AM6 application events.

  4. #4
    Join Date
    Feb 2006
    Posts
    89

    Being helpful to compensate for ignorance :)

    Just to be more helpful.

    This is the only code in the am6 exampel project. It does not conatin anything that would tell the am6 application that the php script is ont he server at http://www.karazoo.com/mailscript.php

    So how can it work?

  5. #5
    Join Date
    Feb 2006
    Posts
    89
    Sorry: forgot the code:

    This is the code from the project that lacks any reference to the php script.

    sEmailTo = Input.GetText("iEMailAddress");
    sMailFrom = String.Concat("AMS Test User", "<biz@karazoo.com>");
    sReplyTo = String.Concat("AMS Test User", "<biz@karazoo.com>");
    sSubject = String.Concat("System Information for ", ""..ComputerName);

    sMessageBody = Table.Concat(tEmailBody, "\r\n", 1, TABLE_ALL)

    SubmitValues = {};
    SubmitValues.mail_to = ""..sEmailTo;
    SubmitValues.reply_to = ""..sReplyTo;
    SubmitValues.mail_from = ""..sMailFrom;
    SubmitValues.subject = ""..sSubject;
    SubmitValues.message = ""..sMessageBody;

    Page.Jump("Send");

  6. #6
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Can't see anything wrong with the AMS part. You seem to have the submit part correct. You do realize that the submit code is on another page and you are jumping to it. Might be better to just put it all on one page and add a label that says "Please Wait" or something like that. You might want to check that there are values in the input fields before submiting though.

    In the PHP file I don't think you need the Requests. The variables passed in from AMS will be available. You just need to add the $ to them. Well I have never used request and it has always worked for me.

    This should be all you need:

    PHP Code:
    <?php 

    $headers 
    "From: $mail_from\r\n"
    $headers .= "Reply-To: $reply_to\r\n"
    $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"
    $headers .= "Content-Transfer-Encoding: 7bit\r\n"

    mail
    $mail_to
    $subject
    $message
    $headers 
    ); 

    ?>
    You can also return a message from your PHP script to AMS like this.

    PHP Code:
    echo "Your email has been sent." 
    It would be a good idea to check that the mail() function succeeded and return an appropriate message.

    By the way your project is AMS 5 not 6.
    Last edited by Dermot; 02-10-2006 at 12:33 PM.
    Dermot

    I am so out of here

  7. #7
    Join Date
    Feb 2006
    Posts
    89
    I was looking ont he wrong page for the submit script.

    Thanks !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts