example.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * QuickEmail
  4. *
  5. * Copyright 2011-2017 Bob Ray
  6. * @file example.php
  7. * @author Bob Ray <https://bobsguides.com>
  8. * @date 1/15/11
  9. *
  10. * QuickEmail is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option) any
  13. * later version.
  14. *
  15. * QuickEmail is distributed in the hope that it will be useful, but WITHOUT ANY
  16. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  17. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along with
  20. * QuickEmail; if not, write to the Free Software Foundation, Inc., 59 Temple
  21. * Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. * @package quickemail
  24. */
  25. /**
  26. * @description A quick email and diagnostic package for MODX Revolution
  27. * @package quickemail
  28. * @subpackage docs
  29. */
  30. /* This example shows how to send email using QuickEmail from inside another snippet.
  31. * Simply copy this code into the snippet and set the right-hand values below.
  32. * Once the mail is working, you'll probably want to set hideOutput to '1'
  33. * or edit 'successMessage'. If debug is off and the mail is successful, the
  34. * only value returned will be 'successMessage'. If hideOutput is set to '1'
  35. * the return value will always be an empty string unless debug is on.
  36. *
  37. * You can also modify the value of $output before returning it and you can test
  38. * it first, to see if it matches the value of 'successMessage'.
  39. *
  40. * All of the parameters are optional and have reasonable defaults so try
  41. * just setting 'message', 'subject', and 'to', and see what you get */
  42. $params = array(
  43. 'debug' => '0',
  44. 'hideOutput' => '0',
  45. 'message' => 'Some Message',
  46. 'subject' => 'Some Subject',
  47. 'to' => 'someone@somewhere.com',
  48. 'fromName' => 'Some Name',
  49. 'emailSender' => 'someone@somewhere.com',
  50. 'replyTo' => 'someone@somewhere.com',
  51. 'html' => '1',
  52. 'failureMessage' => '<br /><h3 style="color:red">Mail Failed</h3>',
  53. 'successMessage' => '<br /><h3 style ="color:green">Mail reported successful</h3>',
  54. 'errorHeader' => '<br />Mail error:',
  55. 'smtpErrorHeader' => '<br />SMTP server report:',
  56. );
  57. $output = $modx->runSnippet('QuickEmail',$params);
  58. return $output;