Sending mail from flash with PHP

  • DrGonzo
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post October 4th, 2006, 6:21 am

Hello,
I have made a contact form that is supposed to send the detail on email via a PHP file. It works to some extent, however it only gives me the details of the last variable in the list?

This is my PHP script:

<?php

$to = "larry@tshirtsetc.co.uk";
$msg = "Name: $_POST[name]\n";
$msg = "Company Name: $_POST[company]\n";
$msg = "Email Address: $_POST[email]\n";
$msg = "Telephone Number: $_POST[telephone]\n";
$msg = "Address: $_POST[address]\n";
$msg = "Small qty: $_POST[s]\n";
$msg = "Medium qty: $_POST[m]\n";
$msg = "Large qty: $_POST[l]\n";
$msg = "XLarge qty: $_POST[x]\n";
$msg = "XXLarge qty: $_POST[xxl]\n";
$msg = "Comments: $_POST[message]\n";


mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");

?>

The only info I get is the last variable - 'message'?

Any one know what i've done wrong?

Thanks,

DrGonzo.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 4th, 2006, 6:21 am

  • Tchuki
  • Mastermind
  • Mastermind
  • No Avatar
  • Joined: Sep 30, 2004
  • Posts: 1774
  • Loc: Edinburgh
  • Status: Offline

Post October 4th, 2006, 8:01 am

http://www.kirupa.com/developer/actions ... _email.htm
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post October 4th, 2006, 9:55 pm

hahahahaa that`s a "i`m tired and not paying attention" mistake ... :D
look again at your code. You always have: $msg = ....
you have to concat it, not to replace it all the time. So the correct code is this:
Code: [ Select ]
<?php

$to = "larry@tshirtsetc.co.uk";
$msg = "Name: $_POST[name]\n";
$msg .= "Company Name: $_POST[company]\n";
$msg .= "Email Address: $_POST[email]\n";
$msg .= "Telephone Number: $_POST[telephone]\n";
$msg .= "Address: $_POST[address]\n";
$msg .= "Small qty: $_POST[s]\n";
$msg .= "Medium qty: $_POST[m]\n";
$msg .= "Large qty: $_POST[l]\n";
$msg .= "XLarge qty: $_POST[x]\n";
$msg .= "XXLarge qty: $_POST[xxl]\n";
$msg .= "Comments: $_POST[message]\n";

mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");

?>
  1. <?php
  2. $to = "larry@tshirtsetc.co.uk";
  3. $msg = "Name: $_POST[name]\n";
  4. $msg .= "Company Name: $_POST[company]\n";
  5. $msg .= "Email Address: $_POST[email]\n";
  6. $msg .= "Telephone Number: $_POST[telephone]\n";
  7. $msg .= "Address: $_POST[address]\n";
  8. $msg .= "Small qty: $_POST[s]\n";
  9. $msg .= "Medium qty: $_POST[m]\n";
  10. $msg .= "Large qty: $_POST[l]\n";
  11. $msg .= "XLarge qty: $_POST[x]\n";
  12. $msg .= "XXLarge qty: $_POST[xxl]\n";
  13. $msg .= "Comments: $_POST[message]\n";
  14. mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");
  15. ?>

p.s.: notice the "." before the "=" ... that is concat.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • DrGonzo
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post October 5th, 2006, 1:47 am

Nice one Ice - Your a star!

I shouldn't work so late.......

Thanks.

DrGonzo.
  • errorbaby
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Oct 16, 2006
  • Posts: 14
  • Status: Offline

Post October 16th, 2006, 8:49 pm

Hi,
I have tried out the tutorial mentioned above http://www.kirupa.com/developer/actions ... _email.htm but I cant seem to get anything back in my mail inbox.

The flash movie works fine (after entering data, the thank you message appears) but that's the furthest I can go.

I have changed the php to what Icecold has coded above (with slight changes to customised to my variables). Can anyone guide me on what went wrong?

My php script is as below:

<?php
$to = "xxx@yahoo.com";
$subject = "My Flash site reply";

$msg = "Name: $_POST["name"]\n";
$msg .= "Email Address: $_POST[email]\n";
$msg .= "Comments: $_POST[message]\n";

mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");
?>

The text that I have highlighted in bold, can someone tell me what it is pointing to? Should I change it?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post October 16th, 2006, 10:48 pm

that's just the "sender" that will appear.
if you dont get anything in your inbox ... either check your bulk messages ... or make sure you have activated the SMTP on the server that you use. aah, and dont expect to send anything using the flash test movie or loading the published html in the browser ... you really need the apache server for this.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • errorbaby
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Oct 16, 2006
  • Posts: 14
  • Status: Offline

Post October 17th, 2006, 12:14 am

I have checked the inbox and bulk folder... no returned message in there. As for the smtp, do you mean chmod? I have set chmod to 755 (hope it is right?) and I have tested the swf file on a test html instead of a published one.... any other solutions :?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post October 17th, 2006, 4:15 am

what does SMTP got to do with chmod?
SMTP = simple mail transmission protocol ...
In windows is activated from IIS ... in linux, i dont know linux :P
maybe you need another mail server in order to send one, don't know.

and to test the file you need to test it like ... this:
http://localhost/tests/myflash.html
or
http://hostedsite.com/myflash.html
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • errorbaby
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Oct 16, 2006
  • Posts: 14
  • Status: Offline

Post October 18th, 2006, 7:46 pm

I am using a free host. Think I can still use this method?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post October 18th, 2006, 10:57 pm

i dont know, ask or see if they provide SMTP support
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • medeea
  • Born
  • Born
  • No Avatar
  • Joined: Jun 11, 2007
  • Posts: 1
  • Status: Offline

Post June 11th, 2007, 9:49 am

Hy,

I've tried all the variants proposed by you and i couldn't send and receive any email.I'm actually a beginner in Flash and i don't know what are the exactly steps to make it work.I don't know which server i need, and, lets say, if i work with asp, how am i supposed to upload the swf/html and asp to the server?I don't know what to do in these pleriminary steps.

Please help me.
Thank you very much
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post June 11th, 2007, 11:17 am

medeea,

Sounds like you need to start with the basics and gradually progress to where it seems you'd like to be.

All of the things you just mentioned are really basic things you have to know before you can go much further. If possible take some basic courses on web design at a local college or online training. I could answer your questions but I don't think you'd understand the answers. I'll give it a shot though.

If you're working with ASP you shouldn't be. Use ASP.NET instead. In either case you should be using a Windows server running IIS. Your files get uploaded to the wwwroot directory in Inetpub folder. If you are working on the server itself just save them there to that directory. If you are working on the server remotely you'll need an FTP client and FTP access to the webserver. To send email with ASP you essentially follow the same steps as above except instead of a php script you would most likely use a standard ASP script using CDONTS or JMAIL (assuming JMAIL is installed). Of course you need an SMTP server running on your Windows server that is capable of sending mail.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • shana1729
  • Born
  • Born
  • No Avatar
  • Joined: Dec 22, 2008
  • Posts: 1
  • Status: Offline

Post December 22nd, 2008, 8:07 pm

I think that your server is not supporting PHP(you may need to install PHP with PEAR in that case). Or your server may not be having SMTP enabled. The code you have written will work for Windows based server. IF you have linux based server the \n at the end has to be replaced with \r\n.

And in order to upload files you need to contact your system admin people/ the poeple who manages your web domain. You can FTP the files into server and test it!

Cheers,
Nishana

http://nishanaa.blogspot.com/2008/11/se ... g-php.html

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 44 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.