Skip to content

Instantly share code, notes, and snippets.

@prabhakar711
Created December 7, 2018 17:13
Show Gist options
  • Save prabhakar711/cae8d51da73817f318c6d91970e31801 to your computer and use it in GitHub Desktop.
Save prabhakar711/cae8d51da73817f318c6d91970e31801 to your computer and use it in GitHub Desktop.
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require("assets/PHPMailer/src/PHPMailer.php");
require("assets/PHPMailer/src/SMTP.php");
require("assets/PHPMailer/src/Exception.php");
$name = trim($_POST['name']);
$email = $_POST['email'];
$phone = $_POST['phone'];
$subject = $_POST['subject'];
$mail = new PHPMailer();
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "mail.wedfusions.com";
$mail->Port = 465; // or 587
$mail->setFrom('from@example.com', 'First Last');
$mail->AddAddress("contact@wedfusions.com");
$mail->Username = "contact@wedfusions.com";
$mail->Password = "jfQw&]B0@f~XC5Y";
$mail->SetFrom("contact@wedfusions.com");
$mail->Name = $name;
$mail->Email = $email;
$mail->PhoneNumber = $phone;
$mail->Subject = $subject;
//$mail->Body = $message;
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment