A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: [RESOLVED] Please Help With PHP : flash contact form won't send emails

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    23

    resolved [RESOLVED] Please Help With PHP : flash contact form won't send emails

    Hello again community,

    Could someone please help me. My contact form does not send messages to my email account.

    I have been facing several issues with my online flash portfolio. My website content and buttons were all made with Flash CS3 using Actionscript 2.0. I used a php script that will interact with my flash contact form to send messages to my email. Then i inserted my swf file into an html blank page i made with Dreamweaver Cs3.

    My server uses PHP 5.2.17. I think the variables in my contact form are not being prompted correctly since I may be using old PHP scripting. I do not know where to being to fix this issue.


    I am attaching my php file to see if this helps to define the cause.
    Thank you in advance for your assistance.


    kris.d
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    if this is your complete script, it lacks the opening <?
    In that case it would also match some ancient (10 years ago) convention to automatically import variables.
    Today you need to do something like
    Code:
    $subject = $_REQUEST['subject'];
    for every variable

    Musicman

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    23

    About Your Suggestion

    Hi Musicman,

    Thanks for responding to my request for PHP code. I will try and use the code as you specified and will let you know if I have further questions.


    Kris.d

  4. #4
    Junior Member
    Join Date
    Feb 2012
    Posts
    23
    Quote Originally Posted by Musicman View Post
    Hi,

    if this is your complete script, it lacks the opening <?
    In that case it would also match some ancient (10 years ago) convention to automatically import variables.
    Today you need to do something like
    Code:
    $subject = $_REQUEST['subject'];
    for every variable

    Musicman
    Hi again,

    I tried reformatting my php code using the coding for each variable as I think you suggested, but my contact form did not send a message to my email after i tested my movie.
    Could you revise my PHP code please? Incase this helps to pinpoint my errors, I am also attaching the Action Script 2.0 that is assigned to my SEND and CLEAR Buttons within my Flash movie's contact form.

    SEND BUTTON As2 code:

    Code:
    on (release) {
             if (name eq "" or subject eq "" or message eq "" or email eq "") {
                   stop();
             } else {
             loadVariablesNum("emailform.php", 0, "POST");
             gotoAndStop(2);
         }
    }
    ------------------------------------------------------------------
    CLEAR FORM BUTTON As2 code:

    Code:
    on (release) {
        name = "";
        subject="";
        message="";
        email="";
    }

    -----------------------------------------------------------------------------
    PHP Code:
    PHP Code:
    <?
    $to = $_REQUEST['kristian.delrio@gmail.com'];
       $msg = $_REQUEST['name\n\n'];
       $msg .= $_REQUEST['message\n\n'];
      mail($to, $subject, $msg, "Message From: Online client\nReply-To: $_REQUEST['email\n']);
    ?>

    Thank you for your help in advance.


    Kris.d

  5. #5
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    That's the way it should look like:

    Code:
    <?
    $to = 'kristian.delrio@gmail.com';
    $name = $_REQUEST['name'];
    $message = $_REQUEST['message'];
    $email = $_REQUEST['email'];
       $msg = "Message From: Online client $email\n\n";
       $msg .= "$name\n\n";
       $msg .= "$message\n\n";
      mail($to, $subject, $msg, "Reply-To: $email");
    ?>
    Things you should consider once it is working: the email should be checked to NOT contain unwanted characters such as newlines

    Musicman

  6. #6
    Junior Member
    Join Date
    Feb 2012
    Posts
    23

    How to make email account setting for receiving PHP messages

    Quote Originally Posted by Musicman View Post
    Things you should consider once it is working: the email should be checked to NOT contain unwanted characters such as newlines

    Musicman
    Thank you for helping me understand how to make the PHP code work.
    I do not know where to look in my email account for the setting you mentioned above (do not contain unwanted characters). Could you give me an idea of the location for that email option please? My email account is with Gmail.

    Thank you in advance for the help.

  7. #7
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    this is not a setting in your email account: it is an extra line of code like
    Code:
    $email = $_REQUEST['email'];
    if(ereg("[\r\n]", $email)) exit;
    A real user of your form would not send newlines, since the input is not multiline.
    A bad guy might target a html form at your script and send
    Code:
    somebody@example.com
    Bcc: joe1@x.com joe2@x.com joe3@x.com
    and all these people would get the bad guy's rubbish message from your server

    Musicman

  8. #8
    Junior Member
    Join Date
    Feb 2012
    Posts
    23
    Quote Originally Posted by Musicman View Post
    Hi,

    this is not a setting in your email account: it is an extra line of code like
    Code:
    $email = $_REQUEST['email'];
    if(ereg("[\r\n]", $email)) exit;
    A bad guy might target a html form at your script and send
    Code:
    somebody@example.com
    Bcc: joe1@x.com joe2@x.com joe3@x.com
    and all these people would get the bad guy's rubbish message from your server

    Musicman
    Hello Musicman,

    Wow thank you for helping me with that stream of code and telling me the necessity of it. Well thanks to you my contact form is functioning well.

    I am doubting something I noticed when i sent my self an email is normal. When i received the message, the user's name was the name and email of my friend's Server where I am currently hosting my website. Is that normal? I attached a screenshot of the message to demonstrate what I said.

    Thank you again for your help.

    kris.d
    Attached Images Attached Images

  9. #9
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    you could try to put something like
    Code:
    mail($to, $subject, $msg, "From: webserver@yoursite.org\nReply-To: $email");
    Please avoid to put the email from the contact form ther unless you can make sure it arrives. Some sites (eg googlemail, aol) add signatures and stuff to their outgoing mails that the receiving mail server might check. Chances are that it might decide "aol has made a public promise that all their mails go through certain ip addresses but this one says aol and comes from hostgator" and would throw it away

    You might try
    Code:
    "From: $email\nSender: webserver@yoursite.org\nReply-To: $email"
    Musicman

  10. #10
    Junior Member
    Join Date
    Feb 2012
    Posts
    23
    Quote Originally Posted by Musicman View Post
    Hi,

    you could try to put something like
    Code:
    mail($to, $subject, $msg, "From: webserver@yoursite.org\nReply-To: $email");
    Code:
    "From: $email\nSender: webserver@yoursite.org\nReply-To: $email"
    Musicman

    Hi,

    Question, would the name of my server be the same as my host?

    Thank you for helping me understand. Very interesting.




    .................................................. ..........................
    Last edited by kris.d; 03-01-2012 at 12:40 PM. Reason: no message input

  11. #11
    Junior Member
    Join Date
    Feb 2012
    Posts
    23
    Hi Music Man,

    Thanks again for your help. Very cool stuff. The code is working nicely.
    There is still a strange problem, I am getting two emails:I now get my messages from the corresponding email inserted by the sender, but I am still receiving the one from my friend's server username. It does not bother me getting double emails. I guess since I am using my friend's server to host my website it will use his username?
    I am including my code. When you get the chance, could you verify my code please?

    Code:
    <?
    $to = 'kristian.delrio@gmail.com';
    $name = $_REQUEST['name'];
    $message = $_REQUEST['message'];
    $email = $_REQUEST['email'];
    
    if(ereg("[\r\n]", $email)) exit;
    
       $msg = "Message From: Online client $email\n\n";
       $msg .= "$name\n\n";
       $msg .= "$message\n\n";
    
    mail($to, $subject, $msg, "Reply-To: $email");
    mail($to, $subject, $msg, "From: $email\nSender: gator1409.hostgator@creativekris.com\nReply-To: $email");
    ?>

    Thanks again so much.

  12. #12
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    you got two mail() lines there ...
    I would prefer just the longer one

    Musicman

  13. #13
    Junior Member
    Join Date
    Feb 2012
    Posts
    23
    Hi Music Man,

    ok thanks for the tip. That makes sense. Now I should only receive one email. Thanks again for all your help.

    kris.d

  14. #14
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Всем привет тоже проблема такого же характера
    я в этом деле полный нуль :) прошу сильно не бить
    в общем есть исходник к форме а php скрипта который обрабатывает эту форму нет
    вот хотел бы поинтересоваться может мне помочь ктонибудь
    исходник
    Всем заранее спасибо
    Attached Files Attached Files

  15. #15
    Junior Member
    Join Date
    Feb 2012
    Posts
    23
    Quote Originally Posted by ewrey View Post
    Всем привет тоже проблема такого же характера
    я в этом деле полный нуль прошу сильно не бить
    в общем есть исходник к форме а php скрипта который обрабатывает эту форму нет
    вот хотел бы поинтересоваться может мне помочь ктонибудь
    исходник
    Всем заранее спасибо
    I appreciate the time you took to write your message, but unfortunately I am unable to read it. I understand english and spanish. If you could write your message in english or spanish I would very much appreciate it.

    I hope I am not offending you. Thanks for the input.

  16. #16
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Quote Originally Posted by kris.d View Post
    I appreciate the time you took to write your message, but unfortunately I am unable to read it. I understand english and spanish. If you could write your message in english or spanish I would very much appreciate it.

    I hope I am not offending you. Thanks for the input.
    Hello everyone, too, the problem of the same nature
    I'm in this business full null please do not hit much
    in general, is the source to form a php script that handles this form is not
    this would help me to ask any living creature
    source
    All thanks in advance
    Attached Files

  17. #17
    Junior Member
    Join Date
    Feb 2012
    Posts
    23
    Quote Originally Posted by ewrey View Post
    Hello everyone, too, the problem of the same nature
    I'm in this business full null please do not hit much
    in general, is the source to form a php script that handles this form is not
    this would help me to ask any living creature
    source
    All thanks in advance
    Attached Files
    Hello again,

    are you saying the script you attached can be used in my flash movie (swf)
    for my php email to work good?

  18. #18
    Registered User
    Join Date
    Mar 2015
    Posts
    5
    Hi Kris, sorry to bump this up but were you able to find the fix for this issue by any chance? How did you do 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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center