<?php //goi thu vien require 'class.smtp.php'; require 'class.phpmailer.php'; require 'PHPMailerAutoload.php'; $nFrom = ""; //mail duoc gui tu dau, thuong de ten cong ty ban $mFrom = ''; //dia chi email cua ban $mPass = ''; //mat khau email cua ban $nTo = ''; //Ten nguoi nhan $mTo = ''; //dia chi nhan mail $mail = new PHPMailer(); $body = 'Bạn đang tìm hiểu về cách gửi email bằng php mailler chúc các bạn có những phút giây vui vẻ.'; // Noi dung email $title = 'Hướng dẫn gửi mail bằng PHPMailer'; //Tieu de gui mail $mail->IsSMTP(); $mail->CharSet = "utf-8"; $mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sever gui mail. $mail->Port = 465; // cong gui mail de nguyen // xong phan cau hinh bat dau phan gui mail $mail->Username = $mFrom; // khai bao dia chi email $mail->Password = $mPass; // khai bao mat khau $mail->SetFrom($mFrom, $nFrom); $mail->AddReplyTo('16521215@gm.uit.edu.vn', 'abc'); //khi nguoi dung phan hoi se duoc gui den email nay $mail->Subject = $title;// tieu de email $mail->MsgHTML($body);// noi dung chinh cua mail se nam o day. $mail->AddAddress($mTo, $nTo); // thuc thi lenh gui mail if(!$mail->Send()) { echo 'Co loi!'; } else { echo 'mail của bạn đã được gửi đi hãy kiếm tra hộp thư đến để xem kết quả. '; } ?>
Standard input is empty
prog.cpp:3:13: warning: character constant too long for its type
require 'class.smtp.php';
^~~~~~~~~~~~~~~~
prog.cpp:4:13: warning: character constant too long for its type
require 'class.phpmailer.php';
^~~~~~~~~~~~~~~~~~~~~
prog.cpp:5:13: warning: character constant too long for its type
require 'PHPMailerAutoload.php';
^~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:7:14: error: empty character constant
$mFrom = ''; //dia chi email cua ban
^~
prog.cpp:8:14: error: empty character constant
$mPass = ''; //mat khau email cua ban
^~
prog.cpp:9:12: error: empty character constant
$nTo = ''; //Ten nguoi nhan
^~
prog.cpp:10:12: error: empty character constant
$mTo = ''; //dia chi nhan mail
^~
prog.cpp:12:25: warning: character constant too long for its type
$body = 'Bạn đang tìm hiểu về cách gửi email bằng php mailler chúc các bạn có những phút giây vui vẻ.'; // Noi dung email
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:13:14: warning: character constant too long for its type
$title = 'Hướng dẫn gửi mail bằng PHPMailer'; //Tieu de gui mail
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:25:23: warning: character constant too long for its type
$mail->AddReplyTo('16521215@gm.uit.edu.vn', 'abc'); //khi nguoi dung phan hoi se duoc gui den email nay
^~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:25:49: warning: multi-character character constant [-Wmultichar]
$mail->AddReplyTo('16521215@gm.uit.edu.vn', 'abc'); //khi nguoi dung phan hoi se duoc gui den email nay
^~~~~
prog.cpp:31:14: warning: character constant too long for its type
echo 'Co loi!';
^~~~~~~~~
prog.cpp:35:14: warning: character constant too long for its type
echo 'mail của bạn đã được gửi đi hãy kiếm tra hộp thư đến để xem kết quả. ';
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cpp:1:1: error: expected unqualified-id before ‘<’ token
<?php
^
prog.cpp:4:5: error: ‘require’ does not name a type
require 'class.phpmailer.php';
^~~~~~~
prog.cpp:5:5: error: ‘require’ does not name a type
require 'PHPMailerAutoload.php';
^~~~~~~
prog.cpp:6:5: error: ‘$nFrom’ does not name a type
$nFrom = ""; //mail duoc gui tu dau, thuong de ten cong ty ban
^~~~~~
prog.cpp:7:5: error: ‘$mFrom’ does not name a type
$mFrom = ''; //dia chi email cua ban
^~~~~~
prog.cpp:8:5: error: ‘$mPass’ does not name a type
$mPass = ''; //mat khau email cua ban
^~~~~~
prog.cpp:9:5: error: ‘$nTo’ does not name a type
$nTo = ''; //Ten nguoi nhan
^~~~
prog.cpp:10:5: error: ‘$mTo’ does not name a type
$mTo = ''; //dia chi nhan mail
^~~~
prog.cpp:11:5: error: ‘$mail’ does not name a type
$mail = new PHPMailer();
^~~~~
prog.cpp:12:5: error: ‘$body’ does not name a type
$body = 'Bạn đang tìm hiểu về cách gửi email bằng php mailler chúc các bạn có những phút giây vui vẻ.'; // Noi dung email
^~~~~
prog.cpp:13:5: error: ‘$title’ does not name a type
$title = 'Hướng dẫn gửi mail bằng PHPMailer'; //Tieu de gui mail
^~~~~~
prog.cpp:14:5: error: ‘$mail’ does not name a type
$mail->IsSMTP();
^~~~~
prog.cpp:15:5: error: ‘$mail’ does not name a type
$mail->CharSet = "utf-8";
^~~~~
prog.cpp:16:5: error: ‘$mail’ does not name a type
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
^~~~~
prog.cpp:17:5: error: ‘$mail’ does not name a type
$mail->SMTPAuth = true; // enable SMTP authentication
^~~~~
prog.cpp:18:5: error: ‘$mail’ does not name a type
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
^~~~~
prog.cpp:19:5: error: ‘$mail’ does not name a type
$mail->Host = "smtp.gmail.com"; // sever gui mail.
^~~~~
prog.cpp:20:5: error: ‘$mail’ does not name a type
$mail->Port = 465; // cong gui mail de nguyen
^~~~~
prog.cpp:22:5: error: ‘$mail’ does not name a type
$mail->Username = $mFrom; // khai bao dia chi email
^~~~~
prog.cpp:23:5: error: ‘$mail’ does not name a type
$mail->Password = $mPass; // khai bao mat khau
^~~~~
prog.cpp:24:5: error: ‘$mail’ does not name a type
$mail->SetFrom($mFrom, $nFrom);
^~~~~
prog.cpp:25:5: error: ‘$mail’ does not name a type
$mail->AddReplyTo('16521215@gm.uit.edu.vn', 'abc'); //khi nguoi dung phan hoi se duoc gui den email nay
^~~~~
prog.cpp:26:5: error: ‘$mail’ does not name a type
$mail->Subject = $title;// tieu de email
^~~~~
prog.cpp:27:5: error: ‘$mail’ does not name a type
$mail->MsgHTML($body);// noi dung chinh cua mail se nam o day.
^~~~~
prog.cpp:28:5: error: ‘$mail’ does not name a type
$mail->AddAddress($mTo, $nTo);
^~~~~
prog.cpp:30:5: error: expected unqualified-id before ‘if’
if(!$mail->Send()) {
^~
prog.cpp:33:7: error: expected unqualified-id before ‘else’
} else {
^~~~
prog.cpp:37:1: error: expected unqualified-id before ‘?’ token
?>
^
Standard output is empty