Jump to content

Mail Confirmation


denoteone

Recommended Posts

there are a few things I am trying to accomplish... make sure they are logged in if not redirect them to the login page. Make sure that they _post is set if it is mail the info. if mail is successful show html page with thank you. if it is not echo error. and give them a chance to go back.

 

Also if they are logged in and they somehow get to this page with out posting data from the previous page  redirect them to the form page...

 


<?php 

session_start();

if(isset($_SESSION['user']))
         {
                if(isset($POST))
                  {
                   $email = $_POST['docemail'];
                    $name = $_POST['name'];
                   $message = $_POST['docname'];
                    $subject = 'doc request';

                   mail('email@email.com',$subject,$headers)


                                   if(mail)!    //if mail fails
                                     {
                                     echo "error sending mail please click her to go back";
                                     } else {
                                             <html> thanks page</html>
                                            }
                 } else{
The user got to this page with out posting data from the previous page redirect them
  }
}else {
redirect back to login
}
?>

 

Is there an easier way to do this or am I even doing it correctly...Any ideas would be awesome.

 

 

Link to comment
Share on other sites

Just some side notes. Alot of syntaxish errors.

 

First mail is not a good system to check if it was sent or not, as the mail function may return false although the mail was sent.

 

Another issue is the isset($POST) should be isset($_POST)

 

Another issue as stated syntax:

 

                  mail('email@email.com',$subject,$headers) ;  need semicolon here/

 

 

                                  if(mail)!    //if mail fails  formated wrong  Should be : if (!mail('email@email.com',$subject,$headers))  which would disregard the above line as it can be consolidated.

 

Anyhow aside from those issues it looks like you have the right idea.

Link to comment
Share on other sites

thank you for the advice.

 

What would you recommend me check to make sure the mail was sent successful.

 

Thanks again.

 

Short of going to an inbox and checking, there is no sure fire way to check. Just the facts of life there, or more or less the facts of mail().

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.