Mail_Queue
[ class tree: Mail_Queue ] [ index: Mail_Queue ] [ all elements ]

Source for file add_example.php

Documentation is available at add_example.php

  1. <?php
  2.  
  3. require_once 'base.php';
  4. $mail_queue =& new Mail_Queue($db_options, $mail_options);
  5.  
  6. $from = 'user@server.com';
  7. $from_name = 'Chief';
  8.  
  9. $recipient = 'user2@server.com';
  10. $recipient_name = 'admin';
  11. $message = 'Hi! This is test message!! :)';
  12. $from_params = !empty($from_name) ? '"'.$from_name.'" <'.$from.'>' : '<'.$from.'>';
  13. $recipient_params = !empty($recipient_name) ? '"'.$recipient_name.'" <'.$recipient.'>' : '<'.$recipient.'>';
  14. $hdrs = array(
  15.     'From'    => $from_params,
  16.     'To'      => $recipient_params,
  17.     'Subject' => 'test message body',
  18. );
  19.  
  20. $mime =& new Mail_mime;
  21. $mime->setTXTBody($message);
  22. $body = $mime->get();
  23. $hdrs = $mime->headers($hdrs);
  24.  
  25.  
  26. /* Put message to queue */
  27. $mail_queue->put($from, $recipient, $hdrs, $body);
  28.  
  29.  
  30. /* Also you could put this msg in more advanced mode */
  31.  
  32. // how many seconds wait to send mail
  33. $seconds_to_send = 3600;
  34.  
  35. // delete mail from db after send?
  36. $delete_after_send = false;
  37.  
  38. // if you backup some mails in db you could group them later by the user identifier, for example
  39. $id_user = 7;
  40.  
  41. $mail_queue->put($from, $recipient, $hdrs, $body, $seconds_to_send, $delete_after_send, $id_user);
  42.  
  43. ?>

Documentation generated on Mon, 11 Mar 2019 15:44:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.