AlanMar

Untitled

Jun 2nd, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1. This DOES NOT work:
  2.  
  3. // message and recipient are both strings
  4. function sendEmail($message, $recipient)
  5. {
  6.   require_once(e_HANDLER . 'mail_manager_class.php');
  7.  
  8.   $mailer = new e107MailManager;
  9.   $mailer->Mailer = 'php';
  10.  
  11.   // Create the mail body
  12.   $mailData = array(
  13.     'mail_total_count'     => 1,
  14.     'mail_content_status'  => MAIL_STATUS_TEMP,
  15.     'mail_create_app'      => 'core',
  16.     'mail_title'           => 'NOTIFY',
  17.     'mail_subject'         => 'Test email',
  18.     'mail_sender_email'    => '[email protected]',
  19.     'mail_sender_name'     => 'Me',
  20.     'mail_notify_complete' => 0,
  21.     'mail_body'            => $message,
  22.     'template'             => 'notify',
  23.     'mail_send_style'      => 'notify',
  24.   );
  25.   // pass recipient email address as a string
  26.   $mailer->sendEmails('notify', $mailData, $recipient);
  27. }
  28.  
  29. This DOES work:
  30.  
  31. function sendEmail($message, $recipient)
  32. {
  33.   require_once(e_HANDLER . 'mail_manager_class.php');
  34.  
  35.   $mailer = new e107MailManager;
  36.   $mailer->Mailer = 'php';
  37.  
  38.   // Create the mail body
  39.   $mailData = array(
  40.     'mail_total_count'     => 1,
  41.     'mail_content_status'  => MAIL_STATUS_TEMP,
  42.     'mail_create_app'      => 'core',
  43.     'mail_title'           => 'NOTIFY',
  44.     'mail_subject'         => 'Test email',
  45.     'mail_sender_email'    => '[email protected]',
  46.     'mail_sender_name'     => 'Me',
  47.     'mail_notify_complete' => 0,
  48.     'mail_body'            => $message,
  49.     'template'             => 'notify',
  50.     'mail_send_style'      => 'notify',
  51.   );
  52.  
  53.   $recipientData = array(array('mail_recipient_email' => $recipient, 'mail_recipient_name' => $recipient));
  54.  
  55.   $mailer->sendEmails('notify', $mailData, $recipientData);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment