-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendEmail.php
More file actions
43 lines (34 loc) · 1.34 KB
/
sendEmail.php
File metadata and controls
43 lines (34 loc) · 1.34 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Send Mail php Mailer</title>
</head>
<body>
<?php
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->Port = 587; // SMTP port
$mail->Username = "wahyulucky28@gmail.com"; // username
$mail->Password = "absenduadelapan"; // password
$mail->SetFrom('user@gmail.com', 'Test');
$mail->Subject = "I hope this works!";
$mail->MsgHTML('Blah');
$address = "wahyulucky28@gmail.com";
$mail->AddAddress($address, "Test");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
</body>
</html>