Exemplo n.º 1
0
 /**
  * dosend function.
  *
  * uses the mymail_dosend hook and triggers the send
  *
  * @access public
  * @param mixed $mailobject        	
  * @return void
  */
 public function dosend($mailobject)
 {
     $this->logger->trace('dosend');
     $this->logger->trace($mailobject->mailer);
     // create a PostmanWpMail instance
     $postmanWpMail = new PostmanWpMail();
     $postmanWpMail->init();
     // create a PostmanMessage instance
     $message = $postmanWpMail->createNewMessage();
     $message->addHeaders($mailobject->headers);
     $message->setBodyTextPart($mailobject->mailer->AltBody);
     $message->setBodyHtmlPart($mailobject->mailer->Body);
     $message->setBody($mailobject->mailer->AltBody . $mailobject->mailer->Body);
     $message->setSubject($mailobject->subject);
     $message->addTo($mailobject->to);
     $message->setReplyTo($mailobject->reply_to);
     $message->setAttachments($mailobject->attachments);
     // create a PostmanEmailLog instance
     $log = new PostmanEmailLog();
     // send the message and store the result
     $mailobject->sent = $postmanWpMail->sendMessage($message, $log);
     // give error message back to MyMail
     $result = apply_filters('postman_wp_mail_result', null);
     if (!$mailobject->sent) {
         $mailobject->set_error($result['exception']->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * The Postman drop-in replacement for the WordPress wp_mail() function
  *
  * @param string|array $to
  *        	Array or comma-separated list of email addresses to send message.
  * @param string $subject
  *        	Email subject
  * @param string $message
  *        	Message contents
  * @param string|array $headers
  *        	Optional. Additional headers.
  * @param string|array $attachments
  *        	Optional. Files to attach.
  * @return bool Whether the email contents were sent successfully.
  */
 function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
 {
     // create an instance of PostmanWpMail to send the message
     $postmanWpMail = new PostmanWpMail();
     // send the mail
     $result = $postmanWpMail->send($to, $subject, $message, $headers, $attachments);
     // return the result
     return $result;
 }