Advertisement
gitlez

Untitled

Jun 4th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. <?php
  2. /*
  3. Simple little script, using your server's mail() function.
  4. If the emails are not received, then the mail() function is either disabled,
  5. or your server is blacklisted from popular mail servers.
  6.  
  7. You will need to use an SMTP mailer. Let me know if you need this, as I can
  8. provide a easy to use method for this.
  9.  
  10. Cheers,
  11.  
  12. Gitlez
  13. gitlez@gmx.com
  14.  
  15. */
  16. $recipientEmail = 'you@email.com'; // The person who will receive the emailed form data
  17. $subject = 'Doggie Daycare Form Submission'; // The subject of the email
  18.  
  19. $fname = $_POST['first_name'];
  20. $lname = $_POST['last_name'];
  21. $email = $_POST['email'];
  22. $telephone = $_POST['telephone'];
  23. $comments = $_POST['comments'];
  24.  
  25. if(strlen($fname) === 0 || strlen($lname) === 0 || strlen($email) === 0 || strlen($comments) === 0){
  26.     $message = 'Some required fields were not supplied. Please complete the required fields and re-submit the form.<br>Please use your browser\'s back button to return to the form.';
  27. }else{
  28.     $emailBody = '-= Form Submission Data =-' . "\r\n";
  29.     $emailBody .= 'Name: ' . $fname . ' ' . $lname . ' ( ' . $email . ' )' . "\r\n";
  30.     $emailBody .= 'Comments:' . "\r\n";
  31.     $emailBody .= $comments . "\r\n";
  32.     $emailBody .= 'Form Submitted: ' . date("D, F j, Y @ H:i:s (e)") . "\r\n";
  33.     if(mail($recipientEmail, $subject, $emailBody)){
  34.         $message = 'Email Sent Successfully!';
  35.     }else{
  36.         $message = 'There was an error sending the email.<br>Please try again later.';
  37.     }
  38. }
  39. ?>
  40. <html>
  41.     <head>
  42.         <title>Email Processing</title>
  43.     </head>
  44. <body>
  45.     <?php
  46.         echo '<h3 style="text-align: center;">' . $message . '</h3>' . PHP_EOL;
  47.     ?>
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement