Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: Can't get a simple email form to work...

  1. #11
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by Graphicsgod View Post
    True, true... Just trying to figure out why nothing gets sent
    It could be a misconfiguration with the mail server. If you cannot get it to work with either PHP nor ASP, then this the case and you should contact your host immediately.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  2. #12
    Join Date
    May 2007
    Location
    Sweden
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    Hi, Rob!

    I think I have the prob! Try this code instead, this might resolve all problems!

    PHP Code:
    <?php 

    // Are we going to send user to another location? True/False 
    $send_to_newPage false

    $to "Rob <mymail@gmail.com>";  
    $name $_POST['first_name'] . " " $_POST['last_name']; 
    $email $_POST['email'];  
    $subject $_POST['attn'];  
    $message $_POST['text_box'];  

    $headers[] = "From: " $name " <" $email ">"
    $headers[] = "MIME-Version: 1.0";
    $headers[] = "Date: " gmdate('D, d M Y H:i:s T'time() ); 

    $subject stripslashes($subject);  
    $body stripslashes($message);  


        if( 
    $send_to_newPage 
        { 

            if( 
    mail($to$subject$bodyimplode("\r\n"$headers)) ) 
            { 
            
    header("Location: thanks.htm"); //Sends to New Page  
            
    }  
            else 
            { 
            echo 
    "<p>An Error Occured, Please Resend<p>"
            } 

        } 
        else 
        { 

            if( 
    mail($to$subject$bodyimplode("\r\n"$headers)) ) 
            { 
            echo 
    "Mail (" $subject "), was successfully sent.";  
            }  
            else 
            { 
            echo 
    "The email (" $subject ") could not be sent.";  
            } 

        } 

    $name stripslashes($name); 

    ?> 

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 

    <html> 
    <head> 
    <title>I.D. Tagem...Thanks!</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
    <!-- meta http-equiv="refresh" content="0;url=thanks.htm" --> 

    </head> 
    <body bgcolor="#ffffff" text="#000000"> 

    <div> 
    <center> 
    <b>Thank you <?php echo $name?></b> 
    <br>Your message has been sent 
    <p><a href="<?php print $continue?>">Click here to continue</a></p> 
    </center> 
    </div> 

    </body> 
    </html>
    Was this code helpfull?

    Best regards,
    mbrodin

  3. #13
    Join Date
    Jun 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Nope same error as before .

    I tried calling up Godaddy.com, and they recommended I spend an extra five bucks a month to have my own server instead of using the shared network that I have now. I figured it was all BS! ..Are they right, or just trying to get me to pony up more money?

    Rob

  4. #14
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Are they right, or just trying to get me to pony up more money?
    Probably the latter. Anyways; as a test, try the following code to see if you get an email.

    Code:
    <?php
    $to = 'you@domain.com'; //change to point to your email address
    
    mail($to, 'Test Message From PHP Script', 'This is a test');
    ?>
    That will show a blank page when you go to it; but after executing the script, wait a few seconds or so (for server lag) and then check your email. If you still get an error, or no error but no email then it is a problem with the mail server.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #15
    Join Date
    Jun 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    Probably the latter. Anyways; as a test, try the following code to see if you get an email.

    That will show a blank page when you go to it; but after executing the script, wait a few seconds or so (for server lag) and then check your email. If you still get an error, or no error but no email then it is a problem with the mail server.

    Hope this helps.
    Tried it and I get no error and no mail. I let it sit for about ten minutes, reloaded the page, tried again and waited for about ten minutes. Changed the email address to another one and did the same, still nothing.

    So if there is a problem with the mail server, how would I word it so that Godaddy.com doesn't point me to a "different more costly plan" ?


    Also heres my PHP details, if anyone is interested...

    PHP page 1

    PHP page 2

    And PHP page 3

    Rob

  6. #16
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by Graphicsgod View Post
    Linux is, from my understanding, better with PHP files. And windows servers are better with ASP.
    No, linux cant use ASP because MS doesn't release any software for linux. A rule of thumb is to create scripts that work regardless of the OS it's run on, so PHP is always a better option than ASP.

    Do you have a mail server at localhost, and what kind?

    EDIT: tell them their mail server might be busted, you only noticed when testing a script you were writing for a freind.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  7. #17
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by boxxertrumps View Post
    No, linux cant use ASP because MS doesn't release any software for linux.
    However, you can get Chili-ASP or Apache::ASP and it will run ASP and ASP.net scripts. Just depends on the distro of Linux and whether you run Apache web server or not.

    Do you have a mail server at localhost, and what kind?
    If you look at the phpinfo in the links posted above, it shows that it is "supposedly" set up at localhost; however, this may not be the case (if they didn't set up the server correctly). Anyways, tell them to check all of the settings on the mail server because you are unable to send emails using a simple PHP script.
    Last edited by thetestingsite; 06-04-2007 at 02:58 PM. Reason: spelling
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  8. #18
    Join Date
    Jun 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok I gave them a call and they said everything "looked" ok on there end. They took a look at the email.php file, I created, and said to create another email server address and use that to test. And after an hour, and it doesn't work, to call them back.

    I also came across a section of my account that says "You currently have no SMTP Relay accounts. Click here to purchase one." I wouldn't need one of these would I?!? I hope not, since it's another five dollars extra a month . I also have no "Email Forwarding", but don't believe that will solve my problem.

    I'll try testing it after an hour and post any results...

    Rob

  9. #19
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    If you want a big more info on configuration, you can run this code--
    PHP Code:
    <?php phpinfo(); ?>
    and this for a couple more precise checks:
    PHP Code:
    <?php
    if (function_exists('mail')) {
       echo 
    "mail() function exists!\n";
       if (
    mail('your@email.com''Test Message From PHP Script''This is a test')) {
          echo 
    "Successfully sent, or so the server thinks...";
          }
       else {
          echo 
    "Sending the email failed.";
          }
       }
    else echo 
    "mail() doesn't exist";
    ?>
    The first will check the server configuration and allow you to check all the setup. It will likely show whether mail is enabled or not.

    The second will check first if the function mail() even exists and if so attempt to send an email. When it attempts this, it will check if the mail worked or not (according to the script), then tell you what it thinks happened. If it says it failed, then that makes sense. If it does say it worked, however, something else is probably going on.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #20
    Join Date
    Jun 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Nope still nothing. Not really wanting to go back through Godaddy.com's tech support. And try to explain over and over again what I want to do. And get a "I'm not sure I follow you." type answer. Or "That will cost you .... dollars, can I sign you up!"... *sigh*


    As for the first one djr33, I've already done that. Look above, I posted links to pictures of the output of the PHP info.

    And as for the second I get:
    Code:
    mail() doesn't exist
    This can't be good right, lol? Don't know what to tell Godaddy.com, that will get through their heads to turn this on, or make it happen without costing me more money .

    Quote Originally Posted by Graphicsgod View Post
    I also came across a section of my account that says "You currently have no SMTP Relay accounts. Click here to purchase one." I wouldn't need one of these would I?!? I hope not, since it's another five dollars extra a month . I also have no "Email Forwarding", but don't believe that will solve my problem.
    So it looks like I might have to pay for the SMTP account on additional to my server and hosting costs ?!?

    Rob

Bookmarks

Posting Permissions

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