mail-wrapper.php 873 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/local/vesta/php/bin/php
  2. <?php
  3. if (empty($argv[1])) {
  4. echo "Error: not enough arguments\n";
  5. exit(3);
  6. }
  7. $options = getopt("s:f:");
  8. define('NO_AUTH_REQUIRED',true);
  9. include("/usr/local/vesta/web/inc/main.php");
  10. // Set system language
  11. exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
  12. $data = json_decode(implode('', $output), true);
  13. if (!empty( $data['config']['LANGUAGE'])) {
  14. $_SESSION['language'] = $data['config']['LANGUAGE'];
  15. } else {
  16. $_SESSION['language'] = 'en';
  17. }
  18. require_once('/usr/local/vesta/web/inc/i18n/'.$_SESSION['language'].'.php');
  19. // Define vars
  20. $from = 'Vesta Control Panel <vesta@'.$_SERVER["HOSTNAME"].'>';
  21. $to = $argv[3]."\n";
  22. $subject = $argv[2]."\n";
  23. $mailtext = file_get_contents("php://stdin");
  24. // Send email
  25. if ((!empty($to)) && (!empty($subject))) {
  26. send_email($to,$subject,$mailtext,$from);
  27. }
  28. ?>