Web Analytics Made Easy -
StatCounter Help needed- Email Sent with Email Submission - CodingForum

Announcement

Collapse
No announcement yet.

Help needed- Email Sent with Email Submission

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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 protected]" 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
    Add the following two lines immediately after your first opening <?php tag -

    PHP Code:
    ini_set ("display_errors""1");
    error_reporting(E_ALL); 
    Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

    Comment


    • #3
      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?

      Comment


      • #4
        That URL doesn't exist. All I get is your host's 404 page. I even corrected the misspelled "emai", but still nothing.
        ZCE

        Comment


        • #5
          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

          Comment

          Working...
          X