mail-wrapper.php 884 B

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