• mail.php
  • /
1 <html>
2 <head>
3 <title>PHPMailer - Mail() advanced test</title>
4 </head>
5 <body>
6
7 <?php
8 require_once(
'class.phpmailer.php');
9 //include(
"class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
10
11 $mail =
new PHPMailer();
12
13 $body =
"shopcantho.vn day ne";
14
15 $mail->IsSMTP();
// telling the class to use SMTP
16 $mail->Host =
"smtp.gmail.com"; // SMTP server
17 $mail->SMTPDebug =
2; // enables SMTP debug information (for testing)
18                                            
// 1 = errors and messages
19                                            
// 2 = messages only
20 $mail->SMTPAuth =
true; // enable SMTP authentication
21 $mail->Host =
"smtp.gmail.com"; // sets the SMTP server
22 $mail->Port =
465; // set the SMTP port for the GMAIL server
23 $mail->Username =
"shopcantho.vn@gmail.com"; // SMTP account username
24 $mail->Password =
""; // SMTP account password
25
26 $mail->SetFrom(
'shopcantho.vn@gmail.com', 'First Last');
27
28 $mail->AddReplyTo(
"shopcantho.vn@gmail.com","First Last");
29
30 $mail->Subject =
"PHPMailer Test Subject via smtp, basic with authentication";
31
32 $mail->AltBody =
"To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
33
34 $mail->MsgHTML($body);
35
36 $address =
"shopcantho.vn@gmail.com";
37 $mail->AddAddress($address,
"John Doe");
38
39 if
(!$mail->Send()) {
40   echo
"Mailer Error: " . $mail->ErrorInfo;
41 }
else {
42   echo
"Message sent!";
43 }
44     
45 ?>
46 </body>
47 </html>



Full source code website bán hàng thương mại điện tử gần giống shopee 466.227 lượt xem

Gõ tìm kiếm nhanh...