form to mail script

  • TINY
  • Born
  • Born
  • TINY
  • Posts: 1

Post 3+ Months Ago

Hey people, hopefully someone on here will be able to help me, this problem is probably very simple, but I'm a bit new to this and this has me completely stumped!

Ok I have created a flash site, and I wanted to incorporate a form on the site where user's can comment/email to me. So I have created the form etc, but now I can't get it to actually send an email to me.

I have looked on my hosting companies site and came accross this:

"When the form is submitted to sendmail.php, the contents of the email field in the form are inserted into a PHP variable called $email, and the contents of the message field are inserted into the variable $message. The script calls a special function called mail, which takes care of the actual dispatch. The first parameter to mail is the address to which you want the form contents sent, in this case your own email address. The second parameter is the subject of the email message, the third is the content of the message, and the fourth is the "From" header so that you know who the sender is, and can reply.

In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent. The PHP component uses SMTP (Simple Mail Transfer Protocol), and all StreamlineNet SMTP servers have filters which ensure that the data returned by either the first or fifth mail parameter relates to one of your domains hosted by StreamlineNet. The final part of the script thanks the visitor for the message. This is done by sending an HTTP header back to the visitor's browser telling it to load a file called thankyou.html from your domain. The /header/function allows you to send any HTTP header back to the browser.

Note: The script has to be enclosed within the “” tags because the PHP processor treats all input as HTML code unless otherwise specified. On some systems, you may need to use “” as the opening and closing tags to get the script to work."

And the .php script they provide is:

PHP Code: [ Select ]
<?php
 
 
 
mail("Youremail@yourdomain.co.uk", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);
 
 
 
header( "Location: <!-- m --><span class="postlink">http://www.yourdomain.co.uk/thankyou.html</span><!-- m -->" );
 
 
 
?>
  1. <?php
  2.  
  3.  
  4.  
  5. mail("Youremail@yourdomain.co.uk", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);
  6.  
  7.  
  8.  
  9. header( "Location: <!-- m --><span class="postlink">http://www.yourdomain.co.uk/thankyou.html</span><!-- m -->" );
  10.  
  11.  
  12.  
  13. ?>


Which I then changed to

PHP Code: [ Select ]
<?php
 
 
 
mail("admin@invisibleman-mcfc.co.uk", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);
 
 
 
header( "Location: <!-- m --><span class="postlink">http://www.invisibleman-mcfc.co.uk/thanks.html</span><!-- m -->" );
 
 
 
?>
  1. <?php
  2.  
  3.  
  4.  
  5. mail("admin@invisibleman-mcfc.co.uk", "Feedback Form results", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]);
  6.  
  7.  
  8.  
  9. header( "Location: <!-- m --><span class="postlink">http://www.invisibleman-mcfc.co.uk/thanks.html</span><!-- m -->" );
  10.  
  11.  
  12.  
  13. ?>



But I dont know what to change so when I click on submit it sends an email to me.

On my flash site, I have created I have this code:
Code: [ Select ]
stop();

fullName_txt.tabIndex = 1;
email_txt.tabIndex = 2;
comments_txt.tabIndex = 3;

submit_btn.onRelease = function() {
var my_lv:LoadVars = new LoadVars();

my_lv.fullName = fullName_txt.text;
my_lv.email = email_txt.text;
my_lv.comments = comments_txt.text;

if (fullName_txt.text != "" && email_txt.text != "" && comments_txt.text != "")
{
my_lv.send("sendmail.php","_blank", "POST");
gotoAndStop("success");
}
else
{
gotoAndStop("error");
}
}
  1. stop();
  2. fullName_txt.tabIndex = 1;
  3. email_txt.tabIndex = 2;
  4. comments_txt.tabIndex = 3;
  5. submit_btn.onRelease = function() {
  6. var my_lv:LoadVars = new LoadVars();
  7. my_lv.fullName = fullName_txt.text;
  8. my_lv.email = email_txt.text;
  9. my_lv.comments = comments_txt.text;
  10. if (fullName_txt.text != "" && email_txt.text != "" && comments_txt.text != "")
  11. {
  12. my_lv.send("sendmail.php","_blank", "POST");
  13. gotoAndStop("success");
  14. }
  15. else
  16. {
  17. gotoAndStop("error");
  18. }
  19. }


Does that look right, or do I need to change something there? hopefully I've put this in the right part of the site, so if anyone can shed any light I'd be very grateful, this is the first site I've come accross that actually looks decent, so hopefully someone can help.

One of the bits I don't understand is where it says

"In order for the script to work, you need to specify, via a fifth -f parameter, the domain from which the mail is being sent. The PHP component uses SMTP (Simple Mail Transfer Protocol), and all StreamlineNet SMTP servers have filters which ensure that the data returned by either the first or fifth mail parameter relates to one of your domains hosted by StreamlineNet"

What am i supposed to do there? I've tried emailing them etc, and I just get the response of "Im sorry we are unable to help you with flash codes, I suggest you try google, thanks" Which is really helpful. SO any help from you guys would be great!

Thanks, and I eagerly await your reply.

TINY
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

i presume admin@invisibleman-mcfc.co.uk is your email.
Well, then look a bit at the php code.
What comes as parameters?
$_REQUEST[message] and $_REQUEST[email] (though i think should be
$_REQUEST['message'] and $_REQUEST['email'] ... you should echo them to make sure it's what you send).
So if those comes as parameters from the flash file, then in the flash file you should have them as well.
So you do have my_lv as a LoadVars class and you should next have message and email.

So, instead of :
Code: [ Select ]
my_lv.fullName = fullName_txt.text;
my_lv.email = email_txt.text;
my_lv.comments = comments_txt.text;
  1. my_lv.fullName = fullName_txt.text;
  2. my_lv.email = email_txt.text;
  3. my_lv.comments = comments_txt.text;

since you already have the email, then the code u need should be:
Code: [ Select ]
my_lv.email = email_txt.text;
my_lv.message = fullName_txt.text + "\n" +comments_txt.text;
  1. my_lv.email = email_txt.text;
  2. my_lv.message = fullName_txt.text + "\n" +comments_txt.text;


the rest of the code remains the same.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 12 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.