-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathnuemailsend.php
57 lines (44 loc) · 1.6 KB
/
nuemailsend.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
<?php require_once('nucommon.php'); ?>
<?php
if ( isset($_SERVER['HTTPS']) ) {
$request_url = "https://";
} else {
$request_url = "http://";
}
$this_url = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
$this_url = explode("/",$this_url);
for ($x=0; $x<count($this_url)-1;$x++) {
$request_url .= $this_url[$x]."/";
}
if ( trim($_REQUEST['calltype']) == 'runphp' ) {
$request_url .= "nurunphp.php?i=".$_REQUEST['debug'];
} else if ( trim($_REQUEST['calltype']) == 'printpdf' ) {
$request_url .= "nurunpdf.php?i=".$_REQUEST['debug'];
} else {
$response['DATA']['email_result'] = false;
$response['DATA']['email_message'] = "Invalid Request Type: ".$_REQUEST['calltype'];
echo json_encode($response);
die();
}
if ( nuValidateEmailAddress($_REQUEST['to']) ) {
$to = $_REQUEST['to'];
$replyto = $_REQUEST['replyto'];
$subject = $_REQUEST['subject'];
$content = $_REQUEST['message'];
$html = false;
$wordWrap = 120;
$filelist = array();
$filename = $_REQUEST['attachment'];
$report = nuEmailGetReportFile('',$request_url);
$filelist[$filename] = $report;
$result = nuSendEmail($to, $replyto, $content, $html, $subject, $wordWrap, $filelist);
@unlink($report);
$response['DATA']['email_result'] = $result[0];
$response['DATA']['email_message'] = $result[1];
echo json_encode($response);
} else {
$response['DATA']['email_result'] = false;
$response['DATA']['email_message'] = "Invalid Email Address";
echo json_encode($response);
}
?>