-
Notifications
You must be signed in to change notification settings - Fork 0
/
testmailphp.php
34 lines (31 loc) · 946 Bytes
/
testmailphp.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
29
30
31
32
33
34
<?php
$quantity = $_GET['quantity'];
$value = $_GET['value'];
$flr = $_GET['flr'];
$tim = $_GET['tim'];
$lim = $_GET['lim'];
require '/usr/share/php/libphp-phpmailer/class.smtp.php';
require '/usr/share/php/libphp-phpmailer/class.phpmailer.php';
$mail = new PHPMailer;
$mail->setFrom('[email protected]');
$mail->addAddress('[email protected]');
$mail->Subject = $flr.' '.$quantity.' crossed threshold';
$mail->Body = 'At Time = '.$tim.'
Threshold value = '.$lim.'
'.$quantity.' reading = '.$value;
$mail->IsSMTP();
$mail->SMTPSecure = 'ssl';
$mail->Host = 'ssl://smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Port = 465;
//Set your existing gmail address as user name
$mail->Username = '[email protected]';
//Set the password of your gmail address here
$mail->Password = 'gmail_password';
if(!$mail->send()) {
echo 'Email is not sent.';
echo 'Email error: ' . $mail->ErrorInfo;
} else {
echo 'Email has been sent.';
}
?>