Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * This example shows how to handle a simple contact form.
- */
- $msg = '';
- //Don't run this unless we're handling a form submission
- if (array_key_exists('name', $_POST)) {
- date_default_timezone_set('Etc/UTC');
- require '/home/wsiwaterproofing/public_html/PHPMailerAutoload.php';
- //Create a new PHPMailer instance
- $mail = new PHPMailer;
- //Tell PHPMailer to use SMTP - requires a local mail server
- //Faster and safer than using mail()
- $mail->isSMTP();
- $mail->Host = 'rverser@wsiwaterproofingservices.com';
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = 'tls';
- $mail->Mailer = "smtp";
- $mail->Port = 465;
- $mail->Username = "rverser@wsiwaterproofingservices.com";
- $mail->Password = "TESTHOTSPRINGS2";
- //Use a fixed address in your own domain as the from address
- //**DO NOT** use the submitter's address here as it will be forgery
- //and will cause your messages to fail SPF checks
- $mail->setFrom('rverser@wsiwaterproofingservices.com', 'Ryan V');
- //Send the message to yourself, or whoever should receive contact for submissions
- $mail->addAddress('nnelly36@yahoo.com', 'Ryan V');
- //Put the submitter's address in a reply-to header
- //This will fail if the address provided is invalid,
- //in which case we should ignore the whole request
- if ($mail->addReplyTo($_POST['name'], $_POST['number'])) {
- $mail->Subject = 'New Request from WSI';
- //Keep it simple - don't use HTML
- $mail->isHTML(false);
- //Build a simple message body
- $mail->Body = <<<EOT
- Name: {$_POST['name']}
- Number: {$_POST['number']}
- Message: {$_POST['message']}
- EOT;
- //Send the message, check for errors
- if (!$mail->send()) {
- //The reason for failing to send will be in $mail->ErrorInfo
- //but you shouldn't display errors to users - process the error, log it on your server.
- $msg = 'Sorry, something went wrong. Please try again later.';
- } else {
- $msg = 'Message sent! Thanks for contacting us.';
- }
- } else {
- $msg = 'Invalid email address, message ignored.';
- }
- }
- header("Location: http://www.wsiwaterproofingservices.com/");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement