-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest004.php
More file actions
54 lines (39 loc) · 1.25 KB
/
Copy pathTest004.php
File metadata and controls
54 lines (39 loc) · 1.25 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
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Created by PhpStorm.
* User: davidkazad
* Date: 23/11/2018
* Time: 13:48
*/
use PHPMailer\PHPMailer\PHPMailer;
require_once '../PHPMailer/src/Exception.php';
require_once '../PHPMailer/src/PHPMailer.php';
require_once '../PHPMailer/src/SMTP.php';
class Test
{
function sendmail($subject, $body, $to, $alias = 'Maishapay Developer', $from = 'maishapay.online@gmail.com', $password = 'Landry@22')
{
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
//$mail->Host = 'mail.maishapay.online';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = $from;
$mail->Password = $password;
$mail->addReplyTo("contact@maishapay.online", "David Kazad");
$mail->setFrom($from, $alias);
$mail->addAddress($to, $alias);
$mail->Subject = $subject;
$mail->msgHTML($body);
if (!$mail->send()) {
return array('resultat' => 0, 'message' => $mail->ErrorInfo);
} else {
return array('resultat' => 1, 'message' => 'email sent!');
}
}
}
$result = new Test();
$rr = $result->sendmail('Test004','je test','14ka135@gmail.com');
echo json_encode($rr);