Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

sendmail.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Postfix Admin
  4. *
  5. * LICENSE
  6. * This source file is subject to the GPL license that is bundled with
  7. * this package in the file LICENSE.TXT.
  8. *
  9. * Further details on the project are available at http://postfixadmin.sf.net
  10. *
  11. * @version $Id: sendmail.php 1842 2016-05-20 20:42:04Z christian_boltz $
  12. * @license GNU GPL v2 or later.
  13. *
  14. * File: sendmail.php
  15. * Used to send an email to a user.
  16. * Template File: sendmail.tpl
  17. *
  18. * Template Variables:
  19. *
  20. * tFrom
  21. * tSubject
  22. * tBody
  23. *
  24. * Form POST \ GET Variables:
  25. *
  26. * fTo
  27. * fSubject
  28. * fBody
  29. */
  30. require_once('common.php');
  31. authentication_require_role('admin');
  32. (($CONF['sendmail'] == 'NO') ? header("Location: main.php") && exit : '1');
  33. $smtp_from_email = smtp_get_admin_email();
  34. if ($_SERVER['REQUEST_METHOD'] == "POST")
  35. {
  36. if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!');
  37. $fTo = safepost('fTo');
  38. $fFrom = $smtp_from_email;
  39. $fSubject = safepost('fSubject');
  40. $tBody = $_POST['fBody'];
  41. if (get_magic_quotes_gpc ())
  42. {
  43. $tBody = stripslashes($tBody); # TODO: check for get_magic_quotes_gpc inside safepost/safeget
  44. }
  45. $email_check = check_email ($fTo);
  46. if (empty ($fTo) or ($email_check != ''))
  47. {
  48. $error = 1;
  49. $tTo = escape_string ($_POST['fTo']);
  50. $tSubject = escape_string ($_POST['fSubject']);
  51. flash_error($PALANG['pSendmail_to_text_error']); # TODO: superfluous?
  52. flash_error($email_check);
  53. }
  54. if ($error != 1)
  55. {
  56. if (!smtp_mail ($fTo, $fFrom, $fSubject, $tBody)) {
  57. flash_error(Config::lang_f('pSendmail_result_error', $fTo));
  58. } else {
  59. flash_info(Config::lang_f('pSendmail_result_success', $fTo));
  60. }
  61. }
  62. }
  63. $smarty->assign ('smtp_from_email', $smtp_from_email);
  64. $smarty->assign ('smarty_template', 'sendmail');
  65. $smarty->display ('index.tpl');
  66. /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
  67. ?>