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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
<?php require 'PHPMailer/PHPMailerAutoload.php';
//$emailHost = "smtp.outlook.office365.com"; $emailHost = "smtp.office365.com"; $emailUserName = "3glasscare@3ss.tv"; $emailPassword = "P34#tstqwe";
$target_file = ""; if(isset($_FILES["fileName"])) { $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileName"]["name"]); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$check = getimagesize($_FILES["fileName"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } move_uploaded_file($_FILES["fileName"]["tmp_name"], $target_file); } //error_reporting(E_ALL);
$tasks_name = array("Medicine_1", "Medicine_2", "Breakfast"); $wound_doc = array("Remark", "Wound_Depth", "Wound_Size"); $content = file_get_contents("mail_templates/report.html"); $tasks_report = ""; $wound_report = ""; foreach($_POST as $name=>$value) { $v = str_replace(' ', '', $value); if(in_array($name, $tasks_name)) { $tasks_report.= "<p><strong>$name</strong>: " . ($v == "Completed" ? '<span style = "color:#00FF00">'. $value . '</span>': $value) . "</p>"; } else if(in_array($name, $wound_doc)) { $wound_report.= "<p><strong>$name</strong>: "; if(strpos($v, 'Notset') === false) { $wound_report.= '<span style = "color:#00FF00">'. $value . '</span>'; } else { $wound_report.= $value; } $wound_report.="</p>"; } } $varsArr['[REPORT_TASKS]'] = $tasks_report; $varsArr['[REPORT_WOUND_DOC]'] = $wound_report; $varsArr['[CARETAKER]'] = $_POST['Caretaker']; $varsArr['[PATIENT]'] = $_POST['Patient']; $mail = new PHPMailer(); $mail->Host = $emailHost; $mail->Port = 587; $mail->SMTPAuth = true; $mail->SMTPSecure = "tls"; $mail->IsSMTP(); $mail->Username = $emailUserName; $mail->Password = $emailPassword;
$mail->setFrom('3glasscare@3ss.tv', '3GlassCare - Report'); $mail->addReplyTo('3glasscare@3ss.tv', '3GlassCare'); $mail->addAddress("glass3sm@gmail.com"); $mail->AddCC("mt@3screen-media.de"); $mail->AddCC("philipp.singer@3ss.tv"); //$mail->addAddress("dlaslo2010@gmail.com"); $mail->Subject = "3GlassCare Report"; if($target_file != "") { $mail->AddAttachment($target_file); } $keys = array_keys($varsArr); foreach($varsArr as $key=>$value) { $content = str_replace($key, $value, $content); } $mail->msgHTML($content, __DIR__); try { $mail->send(); } catch (phpmailerException $e){ $msg = "Email Delivery failed -" . $e->errorMessage(); exit(); } ?>
|