public function send($recipients)
 {
     if (!empty($recipients)) {
         $this->emailObj->setTo($recipients);
         $numberOfEmailsSent = $this->emailObj->send();
         if ($numberOfEmailsSent) {
             return TRUE;
         }
     }
     return FALSE;
 }
예제 #2
0
 /**
  * Sends an e-mail, if sender and recipient is an valid e-mail address
  *
  * @param string $sender The sender
  * @param string $recipient The recipient
  * @param string $subject The subject
  * @param string $body E-Mail body
  * @param string $name Optional sendername
  *
  * @return bool true/false if message is sent
  */
 public function sendEmailMessage($sender, $recipient, $subject, $body, $name)
 {
     if (GeneralUtility::validEmail($sender) && GeneralUtility::validEmail($recipient)) {
         $this->mail->setFrom($sender, $name);
         $this->mail->setSubject($subject);
         $this->mail->setBody($body, 'text/html');
         $this->mail->setTo($recipient);
         $this->mail->send();
         return $this->mail->isSent();
     } else {
         return false;
     }
 }
예제 #3
0
 /**
  * Sends an e-mail, if sender and recipient is an valid e-mail address
  *
  * @param string $sender The sender
  * @param string $recipient The recipient
  * @param string $subject The subject
  * @param string $body E-Mail body
  * @param string $name Optional sendername
  * @param array $attachments Array of files (e.g. ['/absolute/path/doc.pdf'])
  *
  * @return bool TRUE/FALSE if message is sent
  */
 public function sendEmailMessage($sender, $recipient, $subject, $body, $name = null, $attachments = [])
 {
     if (GeneralUtility::validEmail($sender) && GeneralUtility::validEmail($recipient)) {
         $this->initialize();
         $this->mailer->setFrom($sender, $name);
         $this->mailer->setSubject($subject);
         $this->mailer->setBody($body, 'text/html');
         $this->mailer->setTo($recipient);
         $this->addAttachments($attachments);
         $this->mailer->send();
         return $this->mailer->isSent();
     } else {
         return false;
     }
 }
예제 #4
0
 /**
  * Send mail or throw an exception
  *
  * @return int
  * @throws \Exception
  */
 protected function sendMail()
 {
     try {
         return $this->mail->send();
     } catch (\Exception $ex) {
         throw new \Exception('MailView: ' . $ex->getMessage());
     }
 }
 /**
  * send email on new/update.
  *
  * @param string                                    $subjectKey
  * @param \JWeiland\Clubdirectory\Domain\Model\Club $club
  *
  * @return int The amound of email receivers
  */
 public function sendMail($subjectKey, \JWeiland\Clubdirectory\Domain\Model\Club $club)
 {
     $this->view->assign('club', $club);
     $this->mail->setFrom($this->extConf->getEmailFromAddress(), $this->extConf->getEmailFromName());
     $this->mail->setTo($this->extConf->getEmailToAddress(), $this->extConf->getEmailToName());
     $this->mail->setSubject(LocalizationUtility::translate('email.subject.' . $subjectKey, 'clubdirectory'));
     $this->mail->setBody($this->view->render(), 'text/html');
     return $this->mail->send();
 }
 /**
  * Sends the message
  *
  * @return void
  * @throws FailedRecipientsException Is thrown if the
  * underlying messaging service returns one or more failed
  * recipients.
  */
 public function send()
 {
     $acceptedRecipients = $this->message->send();
     $noAcceptedRecipients = 0 === $acceptedRecipients;
     $hasFailedRecipients = count($this->message->getFailedRecipients()) > 0;
     if ($noAcceptedRecipients || $hasFailedRecipients) {
         $exc = new FailedRecipientsException();
         $exc->setSenderList((array) $this->message->getSender());
         $exc->setReceiverList($this->message->getTo());
         $exc->setFailedRecipients($this->message->getFailedRecipients());
         throw $exc;
     }
 }
예제 #7
0
 /**
  * Sends the message.
  *
  * @return integer the number of recipients who were accepted for delivery
  */
 public function send()
 {
     $redirectTo = $this->getRedirectService()->redirectionForCurrentContext();
     // Means we want to redirect email.
     if (!empty($redirectTo)) {
         $body = $this->addDebugInfoToBody($this->getBody());
         $this->setBody($body);
         $this->setTo($redirectTo);
         $this->setCc(array());
         // reset cc which was written as debug in the body message previously.
         $this->setBcc(array());
         // same remark as bcc.
         $subject = strtoupper((string) GeneralUtility::getApplicationContext()) . ' CONTEXT! ' . $this->getSubject();
         $this->setSubject($subject);
     }
     return parent::send();
 }
 /**
  * Sends the actual mail and handles autorespond message
  *
  * @return bool
  */
 public function sendTheMail()
 {
     // Sending the mail requires the recipient and message to be set.
     if (!$this->mailMessage->getTo() || !trim($this->mailMessage->getBody())) {
         return FALSE;
     }
     $this->mailMessage->send();
     // Auto response
     if ($this->autoRespondMessage) {
         $theParts = explode('/', $this->autoRespondMessage, 2);
         $theParts[0] = str_replace('###SUBJECT###', $this->subject, $theParts[0]);
         $theParts[1] = str_replace(array('/', '###MESSAGE###'), array(LF, $this->plainContent), $theParts[1]);
         /** @var $autoRespondMail \TYPO3\CMS\Core\Mail\MailMessage */
         $autoRespondMail = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
         $autoRespondMail->setTo($this->fromAddress)->setSubject($theParts[0])->setFrom($this->recipient)->setBody($theParts[1]);
         $autoRespondMail->send();
     }
     return $this->mailMessage->isSent();
 }
예제 #9
0
 /**
  * Sends the mail.
  * Sending the mail requires the recipient and message to be set.
  *
  * @return void
  */
 protected function send()
 {
     if ($this->mailMessage->getTo() && $this->mailMessage->getBody()) {
         $this->mailMessage->send();
     }
 }
예제 #10
0
파일: EmailPipe.php 프로젝트: kersten/flux
 /**
  * @param MailMessage $message
  * @return void
  */
 protected function sendEmail(MailMessage $message)
 {
     $message->send();
 }