Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['submit'])){
- require 'PHPMailer/PHPMailerAutoload.php';
- // Send mail
- $mail = new PHPMailer();
- // Data received from POST request
- $name = stripcslashes($_POST['tbName']);
- $emailAddr = stripcslashes($_POST['tbEmail']);
- $company = stripcslashes($_POST['tbCompany']);
- $comment = stripcslashes($_POST['taMessage']);
- $subject = stripcslashes($_POST['tbSubject']);
- // SMTP Configuration
- $mail->SMTPAuth = true;
- $mail->Host = "gator3209.hostgator.com"; // SMTP server
- $mail->Username = "****@*****.com";
- $mail->Password = "***********";
- $mail->SMTPSecure = 'tls';
- $mail->Port = 25;
- $mail->AddAddress('****@*****.com');
- $mail->From = "****@*****.com";
- $mail->FromName = "Website Contact Form - " . $name;
- $mail->Subject = $subject;
- $mail->Body = 'This is the HTML message body <b>in bold!</b>';
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
- $mail->MsgHTML("Name:" . $name . "<br /><br />Email:" . $emailAddr. "<br /><br />Company:" . $company. "<br /><br />Subject:" . $subject. "<br /><br />" . $comment);
- $message = NULL;
- if(!$mail->Send()) {
- $message = "Mailer Error: " . $mail->ErrorInfo;
- } else {
- $message = "Message sent!";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement