Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    'Form to mail' script

    Hey people, hopefully someone on here will be able to help me, this problem is probably very simple, but I'm a bit new to this and this has me completely stumped!!

    Ok I have created a flash site, and I wanted to incorporate a form on the site where user's can comment/email to me. So I have created the form etc, but now I can't get it to actually send an email to me.

    I have looked on my hosting companies site and came accross this:

    "When the form is submitted to sendmail.php, the contents of the email field in the form are inserted into a PHP variable called $email, and the contents of the message field are inserted into the variable $message. The script calls a special function called mail, which takes care of the actual dispatch. The first parameter to mail is the address to which you want the form contents sent, in this case your own email address. The second parameter is the subject of the email message, the third is the content of the message, and the fourth is the "From" header so that you know who the sender is, and can reply.

    In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent. The PHP component uses SMTP (Simple Mail Transfer Protocol), and all StreamlineNet SMTP servers have filters which ensure that the data returned by either the first or fifth mail parameter relates to one of your domains hosted by StreamlineNet. The final part of the script thanks the visitor for the message. This is done by sending an HTTP header back to the visitor's browser telling it to load a file called thankyou.html from your domain. The /header/function allows you to send any HTTP header back to the browser.

    Note: The script has to be enclosed within the “” tags because the PHP processor treats all input as HTML code unless otherwise specified. On some systems, you may need to use “” as the opening and closing tags to get the script to work."

    And the .php script they provide is:

    "<?php

    mail("Youremail@yourdomain.co.uk", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);

    header( "Location: http://www.yourdomain.co.uk/thankyou.html" );

    ?>
    "

    But I dont know what to change so when I click on submit it sends an email to me.

    On my flash site, I have created I have this code:
    stop();

    fullName_txt.tabIndex = 1;
    email_txt.tabIndex = 2;
    comments_txt.tabIndex = 3;

    submit_btn.onRelease = function() {
    var my_lv:LoadVars = new LoadVars();

    my_lv.fullName = fullName_txt.text;
    my_lv.email = email_txt.text;
    my_lv.comments = comments_txt.text;

    if (fullName_txt.text != "" && email_txt.text != "" && comments_txt.text != "")
    {
    my_lv.send("sendmail.php","_blank", "POST");
    gotoAndStop("success");
    }
    else
    {
    gotoAndStop("error");
    }
    }

    Does that look right, or do I need to change something there? hopefully I've put this in the right part of the site, so if anyone can shed any light I'd be very grateful, this is the first site I've come accross that actually looks decent, so hopefully someone can help.

    Thanks, and I eagerly await your reply.

    TINY

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,092
    Thanks
    2
    Thanked 23 Times in 23 Posts
    You might try dropping the last parameter, as it is not necessary.

    Code:
    mail("Youremail@yourdomain.co.uk", 
       "Feedback Form results", 
       $_REQUEST[message], 
       "From: $_REQUEST[email]");
    If you still have problems sending mail, you might want to read about the mail function in the manual, including all the comments.

    Hope this helps.

    p.s. - When posting, please use the code tags. Doing so makes it so much easier to read your code. Thanks!
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, thanks for the reply and sorry about the code.

    Ok well I created that HTML file and saved it in the same location as the sendmail.php file on my computer, I called the HTML file 'index.html' then I tested it and press submit, my computer then attempted to open the sendmail.php, and asked me if I wanted to open, save, or cancel. I figure this isn't right?

    The code I used for the sendmail.php was:

    Code:
    <?
      $email = $_REQUEST['email'] ;
      $message = $_REQUEST['comments'] ;
    
      header( "Location: http://www.invisiblman-mcfc.co.uk/contact.swf" );
    ?>
    Deleting out what you suggested. Does it need to be uploaded before it will work? Cheers.

  • #4
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,092
    Thanks
    2
    Thanked 23 Times in 23 Posts
    I read your first post a little closer, and I think I told you wrong about removing that code. My bad. I'd put that back in.

    What I would do is echo out all the variables that go into the mail() function just prior to invoking that function and examine each of their values to see if they're setup correctly. If your flash code is incorrect, someone else will have to step in and help you with that. Sorry.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!


  •  

    Posting Permissions

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