-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREOperation.php
73 lines (56 loc) · 1.56 KB
/
REOperation.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
require_once 'YqBase.php';
require_once 'PHPMailer/PHPMailerAutoload.php';
function load_file($url) {
$ch = curl_init($url);
#Return http response in string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = simplexml_load_string(curl_exec($ch));
return $xml;
}
function setMails ($number){
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->isSMTP();
$mail->Host = 'hwsmtp.exmail.qq.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'Yis2016';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->SetFrom('[email protected]', 'Youth Impact China');
$mail->addAddress('[email protected]', 'Zhu Lun');
$mail->addBCC('[email protected]', 'Youth Impact China');
$mail->isHTML(true);
$mail->addAttachment('a.jpg','测试附件图片');
$mail->Subject =
"自动测试邮件发送:" .$number;
$mail->Body =
'<h3>邮件内容'.$number.'</h3>'.
'<ul>'.
'<li>One</li>'.
'<li>Two</li>'.
'<li>Three</li>'.
'</ul>';
if(!$mail->send()) {
header("Location: /");
} else {
echo '<h4>您的邮件'.$number.'已经发送成功</h4>';
}
}
ini_set("max_execution_time", 2400);
$dbname = 'yiquan';
$host = 'localhost';
$port = '27017';
$user = 'test';
$pwd = 'yiquanTodo';
$mongoClient = new MongoClient("mongodb://{$host}:{$port}",array(
'username'=>$user,
'password'=>$pwd,
'db'=>$dbname
));
$db = $mongoClient->yiquan;
for ($i=0; $i < 2; $i++) {
setMails($i);
}
?>