Page 4 of 4 FirstFirst ... 234
Results 31 to 33 of 33

Thread: Confirmation Email PHP Sender

  1. #31
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by itskater View Post
    Thank you guys,
    Is there anyway to use a different code then exit? If I use echo then exit it shows the echo notice event if it was successful. How can I make it show the failure notice?

    PHP Code:
    $userEmail filter_var$_POST['email'],FILTER_VALIDATE_EMAIL );

    echo 
    'Were sorry, something went wrong. 
    Please go back.'
    ;  

    if( ! 
    $userEmail ){

        exit;

    The notice needs to be in the same block as the exit command - after all, you only want to tell them "something went wrong" if something went wrong.

    PHP Code:
    $userEmail filter_var$_POST['email'],FILTER_VALIDATE_EMAIL );

    if( ! 
    $userEmail ){
        
    // something went wrong.

        // tell the user.
        
    echo 'Were sorry, something went wrong. 
            Please go back.'
    ;  

        
    // make the script end here.
        
    exit;

    I would suggest something more useful than "Please go back" - send them to an actual error page, for example, or show them the form again (with error message(s) included). It's a little more complicated to set up, but it's a lot nicer for all concerned.

    For example:
    PHP Code:
    if( ! $userEmail ){
        
    header"Location: http://example.com/contact-page-with-error-message.php" );
        exit;


  2. #32
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    341
    Thanks
    5
    Thanked 31 Times in 29 Posts

    Default

    Fyi you will need to set up a SMTP if you haven't set one up.

  3. #33
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by Crazykld69 View Post
    Fyi you will need to set up a SMTP if you haven't set one up.
    Please read through the entire thread before replying. The OP is using PHP's mail() function, which simply uses whatever mail program the host enables (usually sendmail). An SMTP server or account is not required (in fact, SMTP is generally not even supported).

Similar Threads

  1. Email Auto-Confirmation
    By misslilly1991 in forum PHP
    Replies: 0
    Last Post: 11-08-2011, 10:42 PM
  2. Adding a confirmation email?
    By Bengal313 in forum PHP
    Replies: 2
    Last Post: 08-05-2010, 06:53 PM
  3. php email confirmation...
    By lirhahs in forum PHP
    Replies: 15
    Last Post: 06-10-2010, 09:27 AM
  4. Simple Email Confirmation/OR cc form
    By almcaffee in forum JavaScript
    Replies: 2
    Last Post: 12-08-2009, 01:27 PM
  5. Sending email confirmation
    By Tayfun in forum PHP
    Replies: 4
    Last Post: 08-12-2009, 08:37 PM

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
  •