mail-wrapper.php 894 B

1234567891011121314151617181920212223242526272829303132333435
  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. require_once(__DIR__.'/exec.php');
  10. define('NO_AUTH_REQUIRED', true);
  11. include("/usr/local/vesta/web/inc/main.php");
  12. // Set system language
  13. v_exec('v-list-sys-config', ['json'], false, $output);
  14. $data = json_decode($output, true);
  15. if (!empty($data['config']['LANGUAGE'])) {
  16. $_SESSION['language'] = $data['config']['LANGUAGE'];
  17. } else {
  18. $_SESSION['language'] = 'en';
  19. }
  20. require_once('/usr/local/vesta/web/inc/i18n/'.$_SESSION['language'].'.php');
  21. // Define vars
  22. $from = 'Vesta Control Panel <vesta@'.gethostname().'>';
  23. $to = $argv[3]."\n";
  24. $subject = $argv[2]."\n";
  25. $mailtext = file_get_contents("php://stdin");
  26. // Send email
  27. if ((!empty($to)) && (!empty($subject))) {
  28. send_email($to,$subject,$mailtext,$from);
  29. }