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
 /**
  * Adds the receiver of the mail message when configured
  *
  * Checks the address if it is a valid email address
  *
  * @return void
  */
 protected function setTo()
 {
     $validEmails = $this->filterValidEmails($this->typoScript['recipientEmail']);
     if (count($validEmails)) {
         $this->mailMessage->setTo($validEmails);
     }
 }
예제 #5
0
 /**
  * Adds the receiver of the mail message when configured
  *
  * Checks the address if it is a valid email address
  *
  * @return void
  */
 protected function setTo()
 {
     $emails = $this->formUtility->renderItem($this->typoScript['recipientEmail.'], $this->typoScript['recipientEmail']);
     $validEmails = $this->filterValidEmails($emails);
     if (!empty($validEmails)) {
         $this->mailMessage->setTo($validEmails);
     }
 }
 /**
  * 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();
 }
예제 #7
0
 /**
  * Adds the receiver of the mail message when configured
  *
  * Checks the address if it is a valid email address
  *
  * @return void
  */
 protected function setTo()
 {
     if ($this->typoScript['recipientEmail'] && \TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($this->typoScript['recipientEmail'])) {
         $this->mailMessage->setTo($this->typoScript['recipientEmail']);
     }
 }
예제 #8
0
파일: EmailPipe.php 프로젝트: kersten/flux
 /**
  * @param string $data
  * @return MailMessage
  */
 protected function prepareEmail($data)
 {
     $body = $this->getBody();
     $sender = $this->getSender();
     $recipient = $this->getRecipient();
     if (TRUE === is_array($recipient)) {
         list($recipientAddress, $recipientName) = $recipient;
     } else {
         $recipientAddress = $recipient;
         $recipientName = NULL;
     }
     if (TRUE === is_array($sender)) {
         list($senderAddress, $senderName) = $sender;
     } else {
         $senderAddress = $sender;
         $senderName = NULL;
     }
     $subject = $this->getSubject();
     if (TRUE === is_string($data)) {
         $body = $data;
     }
     $message = new MailMessage();
     $message->setSubject($subject);
     $message->setFrom($senderAddress, $senderName);
     $message->setTo($recipientAddress, $recipientName);
     $message->setBody($body);
     return $message;
 }
 /**
  * Sets the receiver
  *
  * @param array $receiver Receiver list (mail -> name)
  *
  * @return void
  */
 public function setReceiver(array $receiver)
 {
     $this->message->setTo($receiver);
 }
예제 #10
0
 /**
  * @test
  * @param string|array $addresses
  * @param string|array $expected
  * @dataProvider emailAddressesDataProvider
  */
 public function setToIdnaEncodesAddresses($addresses, $expected)
 {
     $this->subject->setTo($addresses);
     $this->assertSame($expected, $this->subject->getTo());
 }