Skip to content

Instantly share code, notes, and snippets.

@uhmseohun
Last active September 7, 2020 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uhmseohun/b1328685bbf4971b703875afab13039d to your computer and use it in GitHub Desktop.
Save uhmseohun/b1328685bbf4971b703875afab13039d to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aliens Abducted Me - Report an Abduction</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h2>Aliens Abducted Me - Report an Abduction</h2>
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$when_it_happend = $_POST['whenithappened'];
$how_long = $_POST['howlong'];
$how_many = $_POST['howmany'];
$alien_description = $_POST['aliendescription'];
$what_they_did = $_POST['whattheydid'];
$dolly_spotted = $_POST['dollyspotted'];
$email = $_POST['email'];
$other = $_POST['other'];
$to = "uhmtoto@naver.com";
$subject = "Aliens Abductd Me - Abduction Report";
$msg =
"$name was abducted $when_it_happend and was gone for $how_long.<br>" .
"Number of aliens: $how_many<br>" .
"Alien description: $alien_description<br>" .
"What they did: $what_they_did<br>" .
"Dolly spotted: $dolly_spotted<br>" .
"Other comments: $other";
$mail = new PHPMailer(true);
try {
$mail->ContentType = 'text/html';
$mail->CharSet = 'utf-8';
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'uhmtotow@gmail.com';
$mail->Password = 'password';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->setFrom('uhmtotow@gmail.com', '엄서훈');
$mail->addAddress($to, '엄서훈');
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $msg;
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment