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 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2009
    Location
    Indiana
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Help needed- Email Sent with Email Submission

    I am trying to creat a php code that sends an automatic email after the user submits there email.

    the user will first be on the page with the html form, which is :

    Code:
    <html>
    <head>
    <title> Email </title>
    </head>
    <body>
    <center>
    Please send us your email. You will get a confirmation of your submission sent to your suggested email address.
    
    <FORM ACTION="sendemail.php" METHOD="POST">
    
    <INPUT TYPE="TEXT" NAME="email" VALUE="email@domain.com" SIZE="25" MAXLENGTH="150">
    
    <p>
    
    <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit My Email" width="25">
    
    </FORM> 
    
    
    </body>
    </html>
    they submit there email and then will be sent to a page, sendemail.php, which will send the email and give them confirmation, on the page, that the email was succesfully sent. I keep getting the echo, Message delivery failed..., and i dont know whats wrong. The php code is posted below, can someone help?

    PHP Code:

    <?php

    $email 
    $_REQUEST['email'] ;

    $to "$email";

    $subject "Hi!";

    $body "Thank you for visiting something.com. Please visit often as we update weekly! We will have new stuff for you to do often, so subscribe to our mailing list for weekly newsletters. Thanks!";

    if (
    mail($to$subject$body)) {
      echo(
    "<p>Message successfully sent!</p>");
     } else {
      echo(
    "<p>Message delivery failed...</p>");
     }
    ?>

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,107
    Thanks
    2
    Thanked 326 Times in 318 Posts
    Add the following two lines immediately after your first opening <?php tag -

    PHP Code:
    ini_set ("display_errors""1");
    error_reporting(E_ALL); 
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • Users who have thanked CFMaBiSmAd for this post:

    itssawyer (04-02-2009)

  • #3
    New Coder
    Join Date
    Mar 2009
    Location
    Indiana
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts
    thanks CFMaBiSmAd for your post.

    I tried that out, and the page is showing nothing. I think this might of happened before, im not sure because the last time i worked on it was last week some time. heres the url. Any ideas?

  • #4
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    That URL doesn't exist. All I get is your host's 404 page. I even corrected the misspelled "emai", but still nothing.

  • #5
    New Coder
    Join Date
    Mar 2009
    Location
    Indiana
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Srry about the broken link....heres the link

    http://swally.net/email/emailformauto.html

    if you have any idea on why it wouldnt work, please help. the code is above. Thanks


  •  

    Tags for this Thread

    Posting Permissions

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