Add Email::send()
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 22 Jun 2015 19:55:59 +0000 (21:55 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Jun 2015 22:29:16 +0000 (00:29 +0200)
wcfsetup/install/files/lib/system/email/Email.class.php

index bd1cd0f818ef5b10ea4322c01a869211f4eda1a1..4b426799127fbcf5d815254ddc0e7dcfc333a617 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\email;
 use wcf\system\background\job\EmailDeliveryBackgroundJob;
+use wcf\system\background\BackgroundQueueHandler;
 use wcf\system\email\mime\AbstractMimePart;
 use wcf\system\email\mime\TextMimePart;
 use wcf\system\event\EventHandler;
@@ -596,6 +597,18 @@ class Email {
                return $jobs;
        }
        
+       /**
+        * Queues this email for delivery.
+        * This is equivalent to manually queuing the jobs returned by getJobs().
+        * 
+        * @see \wcf\system\email\Email::getJobs()
+        * @see \wcf\system\background\BackgroundQueueHandler::enqueueIn()
+        */
+       public function send() {
+               $jobs = $this->getJobs();
+               BackgroundQueueHandler::getInstance()->enqueueIn($jobs);
+       }
+       
        /**
         * Returns the email RFC 2822 representation of this email.
         *