Guest User

Untitled

a guest
Jul 23rd, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. $to = 'email@example.com';
  2. $from = 'email@example.com';
  3. $subject = 'test subject';
  4.  
  5. $module = '';
  6. $token = time();
  7.  
  8. $message = array(
  9. 'id' => $module . '_' . $token,
  10. 'to' => $to,
  11. 'subject' => $subject,
  12. 'body' => array(
  13. "example body"
  14. ),
  15. 'headers' => array(
  16. 'From' => $from,
  17. 'Sender' => $from,
  18. 'Return-Path' => $from,
  19. 'MIME-Version' => '1.0',
  20. 'Content-Type' => 'text/plain; charset=UTF-8',
  21. ),
  22. 'params' => array(
  23. // 'attachments' => array(
  24. // 0 => array(
  25. // 'path' => "public://invites/test.ics",
  26. // 'filecontent' => "",
  27. // 'filename' => "test.txt",
  28. // 'mime' => "text/plain",
  29. // 'encoding' => 'base64',
  30. // 'disposition' => 'attachment',
  31. // //'list' => TRUE,
  32. // ),
  33. // ),
  34. ),
  35. );
  36.  
  37.  
  38. $system = drupal_mail_system($module, $token);
  39. $message = $system->format($message);
  40.  
  41. if ($system->mail($message)) {
  42. print "sent";
  43. }
  44. else {
  45. print "not sent";
  46. }
Add Comment
Please, Sign In to add comment