01.
<?php
02.
require
'./vendor/autoload.php'
;
03.
$mail
=
new
PHPMailer();
04.
05.
$mail
->SMTPDebug = 0;
06.
07.
$mail
->IsSMTP();
08.
$mail
->Host =
'smtp.gmail.com'
;
09.
$mail
->SMTPAuth = true;
10.
$mail
->Username =
'xxxxxxx@gmail.com'
;
11.
$mail
->Password =
'xxxxxxx'
;
12.
$mail
->SMTPSecure =
'tls'
;
13.
$mail
->Port = 587;
14.
15.
$mail
->setFrom(
'xxxxxxxxxx@gmail.com'
,
'Mailer'
);
16.
$mail
->addAddress(
'xxxxxxxxx@gmail.com'
,
'Joe User'
);
17.
$mail
->addAddress(
'xxxxxxxxx@gmail.com'
);
18.
19.
20.
21.
22.
$mail
->isHTML(true);
23.
24.
$mail
->Subject =
'Here is the subject'
;
25.
$mail
->Body =
'This is the HTML message body <b>in bold!</b>'
;
26.
$mail
->AltBody =
'This is the body in plain text for non-HTML mail clients'
;
27.
28.
29.
30.
31.
$result
=
$mail
-> send();
32.
33.
34.
if
(!
$mail
->send()) {
35.
echo
'Message could not be sent.'
;
36.
echo
'Mailer Error: '
.
$mail
->ErrorInfo;
37.
}
else
{
38.
echo
'Message has been sent'
;
39.
}
40.
?>