Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("PHPMailer-master/PHPMailerAutoload.php");
- $message = trim(htmlspecialchars($_POST["message"]));
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->IsHTML(true);
- $mail->SMTPAuth = true;
- $mail->Host = "smtp.gmail.com";
- $mail->Port = "465";
- $mail->Username = "user";
- $mail->Password = "password";
- $mail->SetFrom("".trim(htmlspecialchars($_POST['email']))."", "".trim(htmlspecialchars($_POST['name']))."");
- $mail->AddAddress("email@email.com");
- $mail->AddReplyTo("".trim(htmlspecialchars($_POST['email']))."", "".trim(htmlspecialchars($_POST['phone']))."");
- $mail->WordWrap = 50;
- $mail->Subject = "".trim(htmlspecialchars($_POST['subject']))."";
- $mail->Body = "<html lang='eng'><head><meta charset='UTF-8'><style>font-size:16px;line-height:1.5em;</style></head><body><?php echo($message)?></body></html>";
- $mail->AltBody = $message;
- if(!$mail->Send()) {
- echo "Message could not be sent. Please try again later.";
- }
- else {
- header("Location: success.html");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement