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!!
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.
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?
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.
(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?
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).
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
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?
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.
...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.
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!
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.