-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
28 lines (26 loc) · 1.13 KB
/
example.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
<?php
$mailto = "yourmail@gmail@gmail.com";
$mailSub = "Lorem Ipsum คือ เนื้อหาจำลองแบบเรียบๆ";
$mailMsg = "
Lorem Ipsum คือ เนื้อหาจำลองแบบเรียบๆ ที่ใช้กันในธุรกิจงานพิมพ์หรืองานเรียงพิมพ์ มันได้กลายมาเป็นเนื้อหาจำลองมาตรฐานของธุรกิจดังกล่าวมาตั้งแต่ศตวรรษที่
";
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail ->IsSmtp();
$mail ->SMTPAuth = true;
$mail ->SMTPSecure = 'tls';
$mail ->Host = "smtp.gmail.com";
$mail ->Port = 587; // or 587
//$mail ->IsHTML(true);
$mail ->Username = "yourmail@gmail.com";
$mail ->Password = "email acount Password";
$mail ->SetFrom("yourmail@gmail.com", "Company name");
$mail ->Subject = $mailSub;
$mail ->Body = $mailMsg;
$mail ->AddAddress($mailto);
if(!$mail->Send()){
echo "Mail Not Sent";
}
else{
echo "Mail Sent";
}