PDA

View Full Version : Problems with PHP-based flash-mailer


Terpentine
07-18-2004, 12:43 AM
Hello!

I'm trying to implement a flash-mailer, but I seem to be unable to get it working. I've been working with the simples of tutorials (like the one in the tutorialsection here on actionscript.org), but they all fail to operate when I install them on my server. It's very strange, when I run the script directly through typing it in in the address-line, the e-mail is dispatched right away. From Flash however, nothing ever happens. Is it possible that my server stops the POST action before it actually reaches the script?

Any help would be greatly appreciated

Cheers, Terpentine

CyanBlue
07-18-2004, 03:00 PM
Howdy... :)

As for a starter... How about setting the script in Flash to send out the data in GET and see if that works??? :)

If that's not the case, post your sample script...

Terpentine
07-18-2004, 03:37 PM
I'm afraid that didn't do the trick. Hmm, it must be a server thing. I'm thinking that I need to do it in perl instead for the time being.

Fla I've been using (http://www.enigmation.com/mailer/mailer.fla)
PHP script (http://www.enigmation.com/mailer/mail.php)

Terpentine
07-18-2004, 03:41 PM
Hmm, I'm having some trouble just downloading a php script through an HTML anchor, so I'm supplying a zip file here instead (in case you have the same problem).

Zip file (http://www.enigmation.com/mailer/myMailer.zip)

thank you

CyanBlue
07-18-2004, 04:52 PM
Well... I am not able to open up your file cuz it is in FMX 2004 format,but try this PHP file instead and let me know how it goes...

<?php
mail("your@email.com", $_POST['subject'], $_POST['message'], "From: PHPMailer\nReply-To: " . $_POST['from'] . "\nX-Mailer: PHP/" . phpversion());
?>

Also, do the copy and paste of your ActionScript if it does not work...

Terpentine
07-18-2004, 05:17 PM
Hmmm, I had no luck with that either. :(

Sorry about the file, I always forget to save as Flash 6. It's fixed now. I still think this is a server issue though...

Thanks :)

The code:

In frame 1

function lineAdapt() {
message_send = message;
trace(message.length);
while (msg_count<message.length) {
msg_count += 1;
if ((substring(message_send, msg_count, 2)) eq "\r") {
message_send = (substring(message_send, 1, msg_count-2)) add "\n" add (substring(message_send, msg_count+2, (length(message_send))-msg_count+2));
}
}
message = message_send;
delete msg_count;
delete message_send;
}


On submit button

on (release) {
if (subject eq "" or message eq "" or from eq "") {
stop();
} else {
lineAdapt();
loadVariablesNum("mail.php", 0, "POST");
gotoAndStop(2);
}
}



As you can see it's old-school AS. I haven't bothered to update the code to Flash MX AS.

CyanBlue
07-18-2004, 08:28 PM
Your file is not even opening in the WinZip... :(

The source file look good... It probably is the server problem but I have no idea what it might be though...

Terpentine
07-18-2004, 09:29 PM
Your file is not even opening in the WinZip... :(

Hehehe, I appear to have a newer WinZip than you as well. Time to get with the program! :D

As you say, probably server-related. I have contacted my ISP and I'm expecting them to get back to me soon. In the meantime, I'm looking into Perl.

Thanks CyanBlue.

T

CyanBlue
07-19-2004, 01:09 AM
Well... Yeah... Let me know what they have to say... :)

One thing though... Just have Flash send out a couple of variables to PHP by using the same method up there and have PHP write some text file with that content so that you will, for sure, know whether you have problem in your code or not... :)

Terpentine
07-19-2004, 09:50 AM
I'll be darned! That did work! (good suggestion). This is getting more and more mysterious! I'm gonna crack this one *today* :)

cheers!

CyanBlue
07-19-2004, 01:49 PM
So, are you done cracking it already??? :)

Terpentine
07-19-2004, 02:36 PM
No! Dammit, this thing is an enigma! The ISP support crew got back to me now, so I trust they will figure it out. After I discovered that I can indeed write the flash variables to file, I'm not so sure it's a server problem anymore though. Anyway, I'm going on holiday in 2 hours. I'll get back on it when I return in a week!

Tada for now :)

T

CyanBlue
07-19-2004, 03:04 PM
Well... Have fun!!! :)

Terpentine
08-06-2004, 01:56 PM
How very strange. I returned to the problem today and all of a sudden it works. I swear I didn't change anything! Ah well, now I have a beautifully functioning form mailer. Thanks for all your help CyanBlue!

CyanBlue
08-06-2004, 02:43 PM
Welcome to the wonderful and strange world of the computer... :D

I'm glad it is working... ;)