A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: [F8] Best way to send mails from kiosk?

  1. #1
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146

    [F8] Best way to send mails from kiosk?

    Hi there and thanks for taking the time!

    Well, I've been researching and asking for help for a week now and nobody seems to figure out why my flash-php form is not working. I've made dozens of tests with 2 Linux servers (PHP ver 4.4.4 and 4.4.7) and these 2 servers seem to be able to send mail if I run the php mailer file directly on the browser but not if called from a stand alone flash projector file...I honestly don't know what da' heck happened because it was working fine for almost a year now (4 months with flash player 8) and suddenly bam!! ...no more.

    Ok so:
    Besides PHP, what is the best way to send mails from a flash projector kiosk communicating with a Linux based server?

    I always thought of those forum users who say in their post titles things like "HEEELP....URGENT!!....I'M DYING...HURRY" to be inappropriate and somewhat of an unfair demand for a free forum so I'm not gonna say that but.....HEEEELP!! he he, no seriously... this wasn't urgent 2 weeks ago but now I could loose a project if I don't come up with a solution.

    So thanks for any help you can give out, I'd really appreciate it!!
    Last edited by Waltman; 11-11-2007 at 08:46 PM.

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    You may be coding for Flash 8 but do you control the version of the player that's used in the browser on the kiosk(s)? How are you sending the data, LoadVars, sendAndLoad, loadVariables? Are you tying to POST it or are you using a GET request? Are you using HTTP or HTTPS? If the Linux based PHP script works when you send data directly, or from a standalone projector then the first step should be to verify that when you send the data from your kiosk application that it's actually getting to the script and not failing. If that's a no-go then I can definitely help you with alternatives to sending mail from a kiosk, but the server side send should definitely be the most reliable.

  3. #3
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146
    Thanks for the reply Northcode,

    Well, I think I've done just about everything people are telling me to:

    -Published for Flash 6,7 and 8.
    -Used sendAndLoad()
    -Used loadVariables()
    -Used LoadVars()
    -Changed all _POST references to _GET in the php file
    -Tried the php file in another server
    -Tested the php file directly on the browser (by the way it worked... but not when called from flash)
    -Uploaded an XML file (silentweed provided) that does the crossdomain thing
    -Typed the AS standing upside down at midnight... (just kidding)

    Regarding the HTTP or HTTPS, I'm guessing HTTP since the php file I'm using for testing is at hhtp://www.e-vendorslist.com/testemail.php
    And as for the projector failing, well yes, the EXE projector file is not sending the data, or communicating with the php file aparently. When I run the EXE file or the SWF file I get nothing, and if I test it inside Flash with [CTR+Enter] I get the "Error openng URL hhtp://www.e-vendorslist.com/testemail.php" message.

    Can you please test my files on your pc and let me know if they work fine?
    Attached Files Attached Files
    Last edited by Waltman; 11-12-2007 at 12:42 AM.

  4. #4
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Let's not waste time testing questionable code

    Here's a simple FLA that will send data to a CGI script on my server that will echo back the variables it receives and their contents.

    If you can see this working then the data is getting to the server.

    If that works I'll provide you with working PHP code to send an email using this FLA and you'll be done.

    This should NOT work if you run the SWF on your machine (because of security) but it SHOULD work if you publish to an EXE and run that.

    Note: You can ignore the commented code. I was thinking about doing the send another way, but changed my mind

    Attached Files Attached Files
    Last edited by Northcode; 11-12-2007 at 02:02 PM.

  5. #5
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146
    Hey Thanks Northcode!!

    "..let's not waste time with questionable code" ha ha I agree soooo much with you.

    Well I created a flash projector file with your fla file, and I got the following feedback data on the right box:

    PHP Code:
    request methodPOST

    message
    Well%20I%27m%20hopping%20this%20will%20work%21%21%20%3A%29

    email
    tellwalter%40gmail%2Ecom

    name
    Walter 
    Is that a good thing? I changed every data field except the last one to the right of the SEND button.

  6. #6
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    That's exactly what you wanted to see. The URL field to the right of the send button wasn't hooked up right, the target CGI script for the send was hard coded. Luckily it was to the right script (echo) which just returns whatever you send it.

    I've attached a new ZIP file with an updated send.fla (to handle line breaks multi-line message bodies that come from Flash text fields) and a copy of the email.php script that's sitting on my server.

    You can test the email.php script on my site but I've disabled the actual send part (to avoid people using it for spam). It will send you back a little report (with error checks) when you hit send, showing you what should normally happen.

    Before you deploy this script on your own server you'll want to change the $from_name and $from_email settings to match who you want the email to appear to be from. You may also want to put some safeguards in to prevent people from abusing the script and using your server to send spam.

    If you have trouble getting this working on your system, let me know and I'll let you test drive it on my server or help you get it working on yours.

    If you're just looking to send email back to yourself from the kiosk application then the implementation will change a bit, but the general approach will be the same.

    If you need help fine tuning this stuff for your particular application, just give me a shout.

    Attached Files Attached Files
    Last edited by Northcode; 11-13-2007 at 01:35 AM.

  7. #7
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146
    Hey Northcode

    Thanks so much for helping I really appreciate you taking the time.

    Ok, so I tested the "send.fla" you provided pointing to the php file in your server, and I got the following feedback:
    PHP Code:
    ----- email -----
    joe@flasher.com
    ----- name -----
    Joe Flasher
    ----- subect -----
    i am the subject
    ----- message -----
    I am the message body,

    I am more than one line.

    I am the last line of the message.
    ----- 
    headers -----

    From"Someone Really Important"<tim.goss@northcode.com>

    Reply-To"Someone Really Important"<tim.goss@northcode.com>

    Return-
    pathtim.goss@northcode.com

    ----- results -----

    mail returned
    (By the way, it works from both, the projector EXE file and the SWF file when testing it in flash)
    But when I uploaded the php file to my server at:
    http://www.e-vendorslist.com/tests/email.php

    I get the following feedback:
    error loading data

    So I guess that means the problem is in the server and not in flash right?
    If so, what are my alternatives NC?
    Last edited by Waltman; 11-13-2007 at 03:48 PM.

  8. #8
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    You might need to slap a crossdomain.xml file on the root of your server to make Flash happy.

    Code:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
       <allow-access-from domain="*" />
    </cross-domain-policy>
    When you're testing from inside Flash you'll be okay, but if you just double click on the SWF to test, THAT won't work (it has to be run in a browser or from an EXE to avoid the local system -> network security restriction).
    Last edited by Northcode; 11-13-2007 at 04:21 PM.

  9. #9
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146
    Northcode,

    I uploaded the crossdomain.xml before, and now I changed that file with the last code you posted. I uploaded it again to the www folder and one upper level too, because that is the nearest I can get to the root, but I don't know if that's enough because it isn't working yet

  10. #10
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Send me a link to where you put the email.php script (support@northcode.com) and I'll give it a whirl from here and see if anything jumps out at me.

  11. #11
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146
    Northcode, I just sent you an email, with the link....and another comment/question on your professional services

    Oh and by the way, if I access that file directly on the browser now it's giving me this error on the page:
    "----- errors ----- message body is missing"

    But I'm guessing that's a validation routine from your code right?
    Last edited by Waltman; 11-13-2007 at 06:07 PM.

  12. #12
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    That's from the PHP script, which proves that it's accessible. That was the first thing I tried when you said it wasn't working. I also tried pulling down your crossdomain.xml file. That worked too butwhen I look at the HTTP headers that are returned with your crossdomain.xml file, it's not the same as what my server is spitting out.

    Here's an HTTP viewer you can use to see what I'm talking about. Your server is saying that your XML file is type application/xml while the one on northcode.com comes back as text/xml.

    That's the only thing I can think of that might be messing Flash up. If it can't see the crossdomain.xml file because of the "wrong" content type then it may assume that you don't have one, and restrict access to the site. That seems to be the only major difference between the results returned from our respective servers.

  13. #13
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146
    Quote Originally Posted by Northcode
    ...Your server is saying that your XML file is type application/xml while the one on northcode.com comes back as text/xml.
    I accessed the linked you gave and made the test too, and I see what you mean. So what can I do about that? or what should I ask my hosting provider to help me with?

    Well...I guess I should start looking for another hosting company then if my current one is making it difficult.

  14. #14
    Gif size does matter Waltman's Avatar
    Join Date
    Mar 2002
    Location
    SoCal
    Posts
    146
    Hallelujah !!

    Northcode, after arguing via email with my hosting provider (because days ago they claimed the did nothing lately to the server), they finally agreed to take a closer look at my case when I told that I could be loosing a client and thus they will be loosing me too.

    An hour later, i got an email saying:

    We've pushed out some new mod_security rules which are causing problems...Access denied with code 403. Pattern match "^Shockwave Flash..." I've disabled mod_security for your domain.

    After that everything got back to normal, can you believe that??? I was so pissed at them but thankful at the same time

    They also said that was caused because this new ruling caused "quite a few messages that have been blocked due to various internet blacklisting services." So definetly I have to research FK for a solution to address this issue so taht my forms are not tagged as spam email senders.

    Well, I'm honestly very thankful with you too Northcode I just like to apologize for not pushing this sooner with my hosting provider and taking advantage your time. The Flashkit community has solved at least 2 out of 3 issues when I asked for help and I think this is a wonderful thing you do for all of us regular flash users. Thanks again!

  15. #15
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    No problem at all man. We're just regular Flash users too, lookin out for our friends

    As far as the explanation provided by your hosting provider....

    Flash as a web client is no more dnagerous than any other web client (browser). I would definitely let them know what harm they could be causing by keeping this rule in place for other domains.

    There are many reasons that a Flash application might hit your web page or a script on your page other than to send an email. You could be providing a web service, trying to host XML documents, etc.

    Flash is everywhere and by blocking Flash as a web client they could be cutting off a large portion of the population from consuming data hosted with them. If they get the bright idea down the road to block AIR (which can host web pages inside it) then they could really be hurting their customers.

    If they were worried about spam being sent from their servers they would have disabled support for mail() in PHP and not blocked the Flash user agent.

    Their reaction of blocking Flash shows a lack of experience or judgement, either way they're now the weakest link in your delivery chain. Keep an eye on them.

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