Need an Email Form that automatically Emails the user a confirmation Email?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sean Watkins
    New Member
    • Jan 2011
    • 48

    Need an Email Form that automatically Emails the user a confirmation Email?

    I have a form on my site that sends the form information directly to an email of mine. What I am wondering is the script that I would need to send a email back to the user who filled out my form, that would state something along the lines of "your Email was received. We will get back to you as soon as possible. I know this can be done, I have seen many sites that do it. I really like and I want to have it on my form. If you guys could please help me out or even link to an appropriate link that would tell me how to do this I would really appreciate it. Thank you guys.
  • AutumnsDecay
    New Member
    • Mar 2008
    • 170

    #2
    Have it send two emails.

    If your form sends an email using PHP's mail() function, just add a second mail line directly after the the mail that gets sent to you.

    Code:
    <?php
    
    mail($to, $subject, $message, $headers);
    mail($to_user, $subject_user, $message_user, $headers_user);
    
    ?>
    Now obviously you'd need to define the variables, but it should be pretty straight forward. Just use the information the user input as their email address for the second email's '$to_user' email address.

    The rest you can just make yourself:

    Code:
    $subject_user = "Thanks for your email!";
    $message_user = "We have received your email. Thank you.";
    etc..

    Comment

    • Sean Watkins
      New Member
      • Jan 2011
      • 48

      #3
      Thank you Sir.

      Comment

      • Sean Watkins
        New Member
        • Jan 2011
        • 48

        #4
        Do i need it the " in-between the variable names.

        mail($to_vis, $subject_user, $message_user,) ;

        this is what I have, $vis is my customers name

        Comment

        • Sean Watkins
          New Member
          • Jan 2011
          • 48

          #5
          it gives me an error message

          Comment

          • Sean Watkins
            New Member
            • Jan 2011
            • 48

            #6
            Or perhaps I need it to read

            mail($vis_user, $subject_user, $message_user,) ;

            $subject_user = "Thanks for your email!";
            $message_user = "We have received your email. We will be contacting you soon.";

            Comment

            • Sean Watkins
              New Member
              • Jan 2011
              • 48

              #7
              Code:
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml">
              <head>
              <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
              <title>Untitled</title>
                
              <style type="text/css">
              .centereddiv
                 {
              	width:400px;
              	height:200px;
              	position: absolute;
              	top:186px;
              	left:446px;
                     }
                 body {
              	background-image: url(http://www.penciledmemories.com/plainbg.jpg);
              	background-position:top center;
              	background-attachment:scroll;
              	background-repeat: no-repeat;
              	background-color: #150a04;
              }
              .style1 {color: #FFFFFF}
              body,td,th {
              	color: #FFFFFF;
              }
              </style>
              
              </head>
              <body>
              <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:100%;">
                <tr>
                  <td>&nbsp;</td>
                  <td width="734" valign="top">
              		<table width="734" border="0" cellspacing="0" cellpadding="0">
              		  <tr>
              			<td valign="top" id="header">&nbsp;</td>
              		  </tr>
              		  <tr>
              			<td valign="top">
              				<table width="734" border="0" cellspacing="0" cellpadding="0">
              				  <tr>
              					<td valign="top" width="18">&nbsp;</td>
              					<td valign="top" width="463" class="wel">
              						<table width="463" border="0" cellspacing="0" cellpadding="0">
              						  <tr>
              							<td valign="top" width="24"></td>
              							<td valign="top" width="419">
              								<table width="419" border="0" cellspacing="0" cellpadding="0">
              								  <tr><td height="12"></td></tr>
              								  <tr>
              									<td valign="top"><div align="center"></div></td>
              								  </tr>
              								  <tr>
              									<td valign="top" height="20"></td>
              								  </tr>
              								  <tr>
              									<td valign="top">
              										<table width="419" border="0" cellspacing="0" cellpadding="0">
              										  <tr>
              											<td valign="top"><div align="center"></p>
                                                          </div>
              											  <h1 align="center" class="style4">&nbsp;</h1>
              											  <h1 align="center" class="style4">&nbsp;</h1>
              											  <h1 align="center" class="style4">
              											    <?php
              
              $ip = $_POST['ip']; 
              $httpref = $_POST['httpref']; 
              $httpagent = $_POST['httpagent']; 
              $vis = $_POST['vis'];
              $vt = $_POST['vt'];
              $va = $_POST['va'];
              $vcsz = $_POST['vcsz'];
              $ve = $_POST['ve']; 
              $sd = $_POST['sd'];
              $ps = $_POST['ps'];
              
              
              
              if (eregi('http:', $notes)) {
              die ("Do NOT try that! ! ");
              }
              if(!$ve == "" && (!strstr($ve,"@") || !strstr($ve,"."))) 
              {
              echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
              $badinput = "<h2>Feedback was NOT submitted</h2>\n";
              echo $badinput;
              die ("Go back! ! ");
              }
              
              if(empty($vis) || empty($ve) || empty($ps )) {
              echo "<h2>Use Back - fill in all fields</h2>\n";
              die ("Use back! ! "); 
              }
              
              $todayis = date("l, F j, Y, g:i a") ;
              
              $attn = $attn ; 
              $subject = $attn; 
              $subject = "Website Customer";
              
              $notes = stripcslashes($notes); 
              
              
              $message = " $todayis [EST] \n
              From: $vis ($ve)\n
              Address: $va \n
              City,State,Zip: $vcsz \n
              Telephone Number: $vt \n
              Portrait Size: $ps \n
              Special Directions: $sd \n 
              
              
              ";
              
              $from = "From: $ve\r\n";
              
              
              mail("brandon@dedikateddesign.com", $subject, $message, $from);
              mail("brandonwatkins6082@yahoo.com", $subject, $message, $from);
              mail("sean@dedikateddesign.com", $subject, $message, $from);
              
              
               
              
              $subject_user = "Thanks for your email!";
              $message_user = "We have received your email. We will be contacting you soon.";
              mail($vis, $subject_user, $message_user,);
              
              
               
              ?>
              
              										      </h1>
              											  <h1 align="center" class="style4">Thank You!</h1>
              											  <h1 align="center" class="style4">We will be contacting you soon.</h1>
              <p align="center">
              <span class="style4">Date: <?php echo $todayis ?></span><br />
              <span class="style4">Thank You :</span> <span class="style4"><?php echo $vis ?> (<?php echo $ve ?>) 
              </span><br />
              
              <span class="style4"><strong>Portrait Size:</strong></span><?php echo $ps ?>
              <br /> 
              <span class="style4"><strong>Special Directions:</strong>
              <?php $notesout = str_replace("\r", "<br/>", $sd); 
              echo $notesout; ?>
              <br />
              <br />
              <?php echo $ip ?> 
              
              <br />
              </span><br />
              <a href="http://www.penciledmemories.com" class="style3"> Home  </a> </td>
              											<td valign="top" width="21"></td>
              											<td valign="top" class="font1">&nbsp;</td>
              										  </tr>
              								    </table>									</td>
              								  </tr>
              								  <tr>
              									<td valign="top" height="37"></td>
              								  </tr>
              								  <tr>
              									<td valign="top">
              										<table width="419" border="0" cellspacing="0" cellpadding="0">
              										  <tr>
              											<td valign="top" width="198">
              												<table width="198" border="0" cellspacing="0" cellpadding="0">
              												  <tr>
              													<td valign="top">&nbsp;</td>
              												  </tr>
              												  <tr>
              													<td valign="top" height="17"></td>
              												  </tr>
              												  <tr>
              													<td valign="top" style="padding-left:5px;">&nbsp;</td>
              												  </tr>
              												  <tr>
              													<td valign="top" height="24"></td>
              												  </tr>
              												  <tr>
              													<td valign="top" align="center">&nbsp;</td>
              												  </tr>
              												  <tr><td height="20"></td></tr>
              											  </table>											</td>
              											<td valign="top" width="23"></td>
              											<td valign="top" width="198">
              												<table width="198" border="0" cellspacing="0" cellpadding="0">
              												  <tr>
              													<td valign="top">&nbsp;</td>
              												  </tr>
              												  <tr>
              													<td valign="top" height="19"></td>
              												  </tr>
              												  <tr>
              													<td valign="top" class="font1" style="padding-left:2px;">&nbsp;</td>
              												  </tr>
              												  <tr>
              													<td valign="top" height="16"></td>
              												  </tr>
              												  <tr>
              													<td valign="top">&nbsp;</td>
              												  </tr>
              												  <tr>
              													<td valign="top" height="8"></td>
              												  </tr>
              												  <tr>
              													<td valign="top">&nbsp;</td>
              												  </tr>
              											  </table>											</td>
              										  </tr>
              									  </table>									</td>
              								  </tr>
              							  </table>							</td>
              							<td valign="top" width="20"></td>
              						  </tr>
              					  </table>					</td>
              					<td valign="top" width="7">&nbsp;</td>
              				  <td valign="top" width="224">
              						<table width="224" border="0" cellspacing="0" cellpadding="0">
              						  <tr>
              							<td valign="top" class="login">
              								<table width="224" border="0" cellspacing="0" cellpadding="0">
              								  <tr>
              									<td valign="top" width="18"></td>
              									<td valign="top" width="184">
              										<form action="" method="post" name="form1">
              											<table width="184" border="0" cellspacing="0" cellpadding="0">
              											  <tr>
              												<td valign="top" height="8"></td>
              											  </tr>
              											  <tr>
              												<td valign="middle">
              													<table width="184" border="0" cellspacing="0" cellpadding="0">
              													  <tr>
              													    <td valign="middle" align="right" class="font2">&nbsp;</td>
              													    <td valign="top">&nbsp;</td>
              												      </tr>
              													  <tr>
                                                                      <td valign="middle" align="right" class="font2">&nbsp;</td>
              													    <td valign="middle" align="right" class="font2"><div align="center"></div></td>
              												      </tr>
              													  <tr>
              														<td valign="middle" align="right" width="53" class="font2"><div align="center"></div></td>
              														<td valign="top" width="127"><div align="center">
              														  <p>&nbsp;</p>
              														  </div></td>
              													  </tr>
              												  </table>												</td>
              											  </tr>
              											  <tr>
              												<td valign="top" height="11"></td>
              											  </tr>
              											  <tr>
              												<td valign="top">&nbsp;</td>
              											  </tr>
              											  <tr>
              												<td valign="top" height="9"></td>
              											  </tr>
              											  <tr>
              												<td valign="top">
              													<table width="184" border="0" cellspacing="0" cellpadding="0">
              													  <tr>
              														<td valign="middle" width="127" class="font2">&nbsp;</td>
              														<td valign="top" align="right" width="56">&nbsp;</td>
              													  </tr>
              												  </table>												</td>
              											  </tr>
              										  </table>
              										</form>									</td>
              									<td valign="top" width="22"></td>
              								  </tr>
              							  </table>							</td>
              						  </tr>
              						  <tr>
              							<td valign="top" class="news">
              								<table width="224" border="0" cellspacing="0" cellpadding="0">
              								  <tr>
              									<td valign="top" width="18"></td>
              									<td valign="top" width="184">
              										<table width="184" border="0" cellspacing="0" cellpadding="0">
              										  <tr>
              											<td valign="top" height="43"></td>
              										  </tr>
              										  <tr>
              											<td valign="top">&nbsp;</td>
              										  </tr>
              										  <tr>
              											<td valign="top" height="31"></td>
              										  </tr>
              										  <tr>
              											<td valign="top">
              												<table width="184" border="0" cellspacing="0" cellpadding="0">
              												  <tr>
              													<td valign="top">&nbsp;</td>
              													<td valign="top" width="17"></td>
              													<td valign="top" width="104" class="font1">&nbsp;</td>
              												  </tr>
              											  </table>											</td>
              										  </tr>
              										  <tr>
              											<td valign="top" height="31"></td>
              										  </tr>
              										  <tr>
              											<td valign="top">
              												<table width="184" border="0" cellspacing="0" cellpadding="0">
              												  <tr>
              													<td valign="top">&nbsp;</td>
              													<td valign="top" width="17"></td>
              													<td valign="top" width="104" class="font1">&nbsp;</td>
              												  </tr>
              											  </table>											</td>
              										  </tr>
              									  </table>									</td>
              									<td valign="top" width="22"></td>
              								  </tr>
              							  </table>							</td>
              						  </tr>
              					  </table>					</td>
              					<td valign="top" width="22"></td>
              				  </tr>
              			  </table>
              			</td>
              		  </tr>
              		  <tr>
              			<td valign="top" class="footer">
              				<table width="734" border="0" cellspacing="0" cellpadding="0">
              				  <tr><td height="26"></td></tr>
              				  <tr>
              					<td valign="top" width="18"></td>
              					<td valign="top" width="500" class="font2"><img alt=""  src="file:///D|/Customer Websites/Contact Forms/images/spacer.gif" height="6" style="display:block "></td>
              					<td valign="top" width="175" align="right" class="font4">&nbsp;</td>
              					<td width="42"></td>
              				  </tr>
              			  </table>
              			</td>
              		  </tr>
              		  <tr><td height="10"></td></tr>
              	  </table>
              	</td>
                  <td>&nbsp;</td>
                </tr>
              </table>
              <p style="text-align:center;font-family:Tahoma;font-size:12px;"><a href="http://www.dedikateddesign.com" style="font-size:12px;font-weight:bold;" title="Web Hosting">Web Hosting</a> by DediKated Design</p>
              </body>
              </html>

              Comment

              • JKing
                Recognized Expert Top Contributor
                • Jun 2007
                • 1206

                #8
                You've left out the fourth parameter in the mail() function which is the From header.

                Comment

                • Sean Watkins
                  New Member
                  • Jan 2011
                  • 48

                  #9
                  Parse error: syntax error, unexpected ')' in /home/bw6082/public_html/sendeail.php on line 129

                  Comment

                  • Sean Watkins
                    New Member
                    • Jan 2011
                    • 48

                    #10
                    Ok, the form didn't give me any errors when adding the headers mail function. But for some reason, when testing it, I didn't get the email from the form. Why could this be?

                    Comment

                    • Sean Watkins
                      New Member
                      • Jan 2011
                      • 48

                      #11
                      Code:
                      $subject_user = "Thanks for your email!";
                      $message_user = "We have received your email. We will be contacting you soon.";
                      mail($vis, $subject_user, $message_user, $headers_user);

                      Comment

                      • JKing
                        Recognized Expert Top Contributor
                        • Jun 2007
                        • 1206

                        #12
                        Did you check your junk mail?

                        Comment

                        • Sean Watkins
                          New Member
                          • Jan 2011
                          • 48

                          #13
                          Ok great, It worked. JKing is there a way to send it and not make it go to the junk folder? Or does that automatically do that depending on the users email application? Also it is saying its coming from a weird email address. Is there a way to assign a certain email address in the form, so the users will see its from that specific email? Example: Sean@mysite.com

                          Comment

                          • AutumnsDecay
                            New Member
                            • Mar 2008
                            • 170

                            #14
                            $headers isn't 100% required. It's useful for sorting filters and for reply-to email addresses, but it will still send without any headers.

                            But, you are right. If I'm going to give an answer I should probably give the 100% answer.

                            Comment

                            • Sean Watkins
                              New Member
                              • Jan 2011
                              • 48

                              #15
                              Autumns you were right Sir, I just didn't add it. It was my fault, not yours. But now I have another issue, can you direct it so it doesn't go to spam? OR is that impossible? Also it's saying its not coming from the right email address in the users :from, on their email address. It gives a weird address. Can you edit that, so you can state what email it is coming from?

                              Comment

                              Working...