-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail.php
64 lines (53 loc) · 2.1 KB
/
mail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
if($_POST){
$name = $_POST['name'];
$email = $_POST['email'];
$msg = $_POST['messg'];
$issues = $_POST['issues'];
$message = "";
$message .= '<html><body>';
$message .= '<h2>Hi there,</h2><br/>';
$message .= '<p>We have a new lead for you from Gachyi Land.</p>';
$message .= '<ul>';
$message .= '<li>Name: '.$name.'</li>';
$message .= '<li>Email: '.$email.'</li>';
$message .= '<li>Issues: '.$issues.'</li>';
$message .= '<li>Message: <p>'.$msg.'</p></li>';
$message .= '</ul>';
$message .= '</body></html>';
$mail = new PHPMailer();
// Settings
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.gmail.com"; // SMTP server example
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // SMTP account username example
$mail->Password = "GooGoo5001995*"; // SMTP account password example
// Content
$mail->isHTML(true);
// $headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
// $headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
// $headers .= "CC: [email protected]\r\n";
// $headers .= "MIME-Version: 1.0\r\n";
// $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$mail->addAddress('[email protected]', $name); //Add a recipient
$mail->addBcc("[email protected]"); //Add BCC
$mail->Subject = 'ATTN: Contact Request from Gachyi Land';
$mail->Body = $message;
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
//send email
if($mail->send())
{
echo "Message Sent.";
}
else{
echo "There was an error sending email.";
}
}
?>