Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Simple little script, using your server's mail() function.
- If the emails are not received, then the mail() function is either disabled,
- or your server is blacklisted from popular mail servers.
- You will need to use an SMTP mailer. Let me know if you need this, as I can
- provide a easy to use method for this.
- Cheers,
- Gitlez
- gitlez@gmx.com
- */
- $recipientEmail = 'you@email.com'; // The person who will receive the emailed form data
- $subject = 'Doggie Daycare Form Submission'; // The subject of the email
- $fname = $_POST['first_name'];
- $lname = $_POST['last_name'];
- $email = $_POST['email'];
- $telephone = $_POST['telephone'];
- $comments = $_POST['comments'];
- if(strlen($fname) === 0 || strlen($lname) === 0 || strlen($email) === 0 || strlen($comments) === 0){
- $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.';
- }else{
- $emailBody = '-= Form Submission Data =-' . "\r\n";
- $emailBody .= 'Name: ' . $fname . ' ' . $lname . ' ( ' . $email . ' )' . "\r\n";
- $emailBody .= 'Comments:' . "\r\n";
- $emailBody .= $comments . "\r\n";
- $emailBody .= 'Form Submitted: ' . date("D, F j, Y @ H:i:s (e)") . "\r\n";
- if(mail($recipientEmail, $subject, $emailBody)){
- $message = 'Email Sent Successfully!';
- }else{
- $message = 'There was an error sending the email.<br>Please try again later.';
- }
- }
- ?>
- <html>
- <head>
- <title>Email Processing</title>
- </head>
- <body>
- <?php
- echo '<h3 style="text-align: center;">' . $message . '</h3>' . PHP_EOL;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement