-
Notifications
You must be signed in to change notification settings - Fork 0
/
send.php
39 lines (31 loc) · 1.23 KB
/
send.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
35
36
37
38
39
<?php
include("phpmailer/PHPMailerAutoload.php");
//https://stackoverflow.com/questions/8676183/echoing-out-a-random-variable
//Define different content that fetch from API
$content1 = file_get_contents('http://loripsum.net/api');
$content2 = file_get_contents('https://baconipsum.com/api/?type=meat-and-filler¶s=5&format=text');
$content3 = file_get_contents('https://api.jokes.one/jod?category=animal');
$content4 = file_get_contents('https://api.jokes.one/jod?category=blonde');
$content5 = file_get_contents('https://api.jokes.one/jod');
//Define Array with content(x)
$array = array($content1, $content2, $content3, $content4, $content5);
$emailText = $array[rand(0, count($array) - 1)];
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 4;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->CharSet = 'UTF-8';
//$mail->Encoding = 'base64';
$mail->Host = 'mail.your-server.net';
$mail->Port = '587';
$mail->isHTML();
$mail->Username = '[email protected]';
$mail->Password = 'pYj87T9nWvQotq8y';
$mail->SetFrom('nor-reply', 'noreply Your-Server');
$mail->Subject = "Notification";
$mail->Body = $emailText;
$mail->AddAddress("[email protected]");
$mail->AddAddress("[email protected]");
$mail->Send();
?>