예제 #1
0
 /**
  * Applies the arguments provided while invoking this plugin to the MailService,
  * discarding any previous configuration
  *
  * @param array $args
  */
 protected function applyArgsToMailService(array $args)
 {
     if (isset($args['body'])) {
         $body = $args['body'];
         if (is_string($body)) {
             $this->mailService->setBody($body);
         } else {
             $this->mailService->setTemplate($body);
         }
     }
     if (isset($args['subject'])) {
         $this->mailService->setSubject($args['subject']);
     }
     if (isset($args['to'])) {
         $this->mailService->getMessage()->setTo($args['to']);
     }
     if (isset($args['cc'])) {
         $this->mailService->getMessage()->setCc($args['cc']);
     }
     if (isset($args['bcc'])) {
         $this->mailService->getMessage()->setBcc($args['bcc']);
     }
     if (isset($args['encoding'])) {
         $this->mailService->getMessage()->setEncoding($args['encoding']);
     }
     if (isset($args['attachments'])) {
         $this->mailService->setAttachments($args['attachments']);
     }
     $this->applyArrayArgs($args, 'from');
     $this->applyArrayArgs($args, 'replyTo');
 }
예제 #2
0
 /**
  * Applies the arguments provided while invoking this plugin to the MailService,
  * discarding any previous configuration
  *
  * @param array $args
  */
 protected function applyArgsToMailService(array $args)
 {
     if (isset($args['body'])) {
         $body = $args['body'];
         if (is_string($body)) {
             $this->mailService->setBody($body);
         } else {
             $this->mailService->setTemplate($body);
         }
     }
     if (isset($args['subject'])) {
         $this->mailService->setSubject($args['subject']);
     }
     if (isset($args['to'])) {
         $this->mailService->getMessage()->setTo($args['to']);
     }
     if (isset($args['from'])) {
         $from = $args['from'];
         if (is_array($from)) {
             $fromAddress = array_keys($from);
             $fromName = array_values($from);
             $this->mailService->getMessage()->setFrom($fromAddress[0], $fromName[0]);
         } else {
             $this->mailService->getMessage()->setFrom($from);
         }
     }
     if (isset($args['cc'])) {
         $this->mailService->getMessage()->setCc($args['cc']);
     }
     if (isset($args['bcc'])) {
         $this->mailService->getMessage()->setBcc($args['bcc']);
     }
     if (isset($args['attachments'])) {
         $this->mailService->setAttachments($args['attachments']);
     }
 }