Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post

    Neither GET nor POST will work for email

    Hello

    I am trying to send an email to my own inbox from a contact form here:

    http://stevehigham59.7host.com/myFlash/graphic9.html

    The email refuses to be sent and I have received nothing in my email box.

    I have tried the PHP script using GET as follows:

    <?php

    //create short variable names
    $name=$_GET['name'];
    $email=$_GET['email'];
    $business=$_GET['business'];
    $country=$_GET['country'];
    $message=$_GET['message'];
    $name=trim($name);
    $email=trim($email);
    $business=StripSlashes($business);
    $country=StripSlashes($country);
    $message=StripSlashes($message);

    /*#########
    modify the next line with your own email address
    ###########*/

    $toaddress='myName@myInbox.com';


    mail($toaddress,$business,$country,$message,"From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n");
    //clear the variables
    $name='';
    $email='';
    $business='';
    $country='';
    $message='';
    exit;
    ?>

    And I have tried it using POST:

    <?php

    //create short variable names
    $name=$_POST['name'];
    $email=$_POST['email'];
    $business=$_POST['business'];
    $country=$_POST['country'];
    $message=$_POST['message'];
    $name=trim($name);
    $email=trim($email);
    $business=StripSlashes($business);
    $country=StripSlashes($country);
    $message=StripSlashes($message);

    /*#########
    modify the next line with your own email address
    ###########*/

    $toaddress='myName@myInbox.com';


    mail($toaddress,$business,$country,$message,"From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n");
    //clear the variables
    $name='';
    $email='';
    $business='';
    $country='';
    $message='';
    exit;
    ?>

    But neither seems to work. Is it likely that the above scripts are incorrect, or is it likely that Flash cannot see my PHP file?

    Many thanks.

    Steve

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Location
    Quebec
    Posts
    261
    Thanks
    6
    Thanked 7 Times in 7 Posts
    For one, did you put in your own email?
    PHP Code:
    $toaddress='myName@myInbox.com'
    Also, try adding this with your variables. I think mail() can only take one variable for its message part.
    PHP Code:
    $completeMessage $business."\n".$country."\n".$message."";
    $headers "From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n"
    Add that to the bottom of your variable list and then modify the mail() statement like so:
    PHP Code:
    mail($toaddress,$completeMessage,$headers); 
    What does your form look like?

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello fl00d

    Thank you for your post.

    This is the code I have now (which does not work):

    <?php

    //create short variable names
    $name=$_POST['name'];
    $email=$_POST['email'];
    $business=$_POST['business'];
    $country=$_POST['country'];
    $message=$_POST['message'];
    $name=trim($name);
    $email=trim($email);
    $business=StripSlashes($business);
    $country=StripSlashes($country);
    $message=StripSlashes($message);

    /*#########
    modify the next line with your own email address
    ###########*/

    $toaddress='myEmail@yahoo.com';

    mail($toaddress,$business,$country,$message,"From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n");
    //clear the variables
    $name='';
    $email='';
    $business='';
    $country='';
    $message='';
    exit;

    ?>
    The form I have looks like this:

    http://stevehigham59.7host.com/myFlash/graphic9.html

    Yes, I did put in my own email address and I DO receive a message, but in the from field I have: me@localhost.com and there is nothing about the user's email.

    However, I get (in the message field of my own inbox) USA (where I have typed in USA in the country field), and I get the message I typed in in the message field.

    It seems to be retrieving some data (but not the email address) and it is not formatted coherently.

    Would you please indicate where/how I should make the amendments you suggest?

    Thanks again for your help.

    Best for 2008!

    Steve

  • #4
    Regular Coder
    Join Date
    Jun 2007
    Location
    Los Angeles
    Posts
    545
    Thanks
    81
    Thanked 5 Times in 5 Posts
    Where did you get those $business, $country arguments from? Those arguments are not right.

    These are the arguments to use mail():

    mail("$to", "$subject", "$body", "$from");

    *That* works - give it a shot...
    RalphF
    Business Text Messaging Services
    https://www.MobileTextingService.com

  • #5
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello rfresh

    Thank you for your post.

    I do receive an email when I send it to myself, but the email appears not to be sending after I press submit.

    Should the code, then, look something like this:

    <?php

    //create short variable names
    $name=$_POST['name'];
    $email=$_POST['email'];
    $business=$_POST['business'];
    $country=$_POST['country'];
    $message=$_POST['message'];
    $name=trim($name);
    $email=trim($email);
    $business=StripSlashes($business);
    $country=StripSlashes($country);
    $message=StripSlashes($message);

    /*#########
    modify the next line with your own email address
    ###########*/

    $toaddress='myEmail@yahoo.com';


    mail("$toaddress","$business","$country","$message","From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\nCc: $email\r\n");
    //clear the variables
    $name='';
    $email='';
    $business='';
    $country='';
    $message='';
    exit;

    ?>

    Many thanks.

    Steve

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    The previous posters have already pointed this out but you should review the parameters you are passing to the mail function Please review the mail function in the documentation http://us.php.net/function.mail
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #7
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Spookster

    Many thanks for your message and link. I have downloaded it and it looks heavy, but I will try to pursue!

    Thanks.

    Steve


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •