forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail-wrapper.php
More file actions
executable file
·38 lines (31 loc) · 938 Bytes
/
mail-wrapper.php
File metadata and controls
executable file
·38 lines (31 loc) · 938 Bytes
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
#!/usr/local/hestia/php/bin/php
<?php
error_reporting(NULL);
if (empty($argv[1])) {
echo "ERROR: not enough arguments\n";
echo "USAGE: mail-wrapper.php -s SUBJECT EMAIL [NOTIFY]\n";
exit(3);
}
$options = getopt("s:f:");
if ((!empty($argv[4])) && ($argv[4] == 'no')) {
exit;
}
define('NO_AUTH_REQUIRED',true);
include("/usr/local/hestia/web/inc/main.php");
// Set system language
exec (HESTIA_CMD . "v-list-sys-config json", $output, $return_var);
$data = json_decode(implode('', $output), true);
if (!empty( $data['config']['LANGUAGE'])) {
$_SESSION['language'] = $data['config']['LANGUAGE'];
} else {
$_SESSION['language'] = 'en';
}
// Define vars
$from = 'Hestia Control Panel <hestia@'.gethostname().'>';
$to = $argv[3]."\n";
$subject = $argv[2]."\n";
$mailtext = file_get_contents("php://stdin");
// Send email
if ((!empty($to)) && (!empty($subject))) {
send_email($to,$subject,$mailtext,$from);
}