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 protected]',$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
https://forums.phpfreaks.com/topic/93566-mail-confirmation/
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 protected]',$subject,$headers) ;  need semicolon here/

 

 

                                  if(mail)!    //if mail fails  formated wrong  Should be : if (!mail('[email protected]',$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
https://forums.phpfreaks.com/topic/93566-mail-confirmation/#findComment-479477
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
https://forums.phpfreaks.com/topic/93566-mail-confirmation/#findComment-479485
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.