/**
  *
  */
 public function testNoTo()
 {
     $fromEmail = '*****@*****.**';
     $toEmails = null;
     $message = MailManager::getMailMessage($fromEmail, 'test Subject', 'testContent', $toEmails);
     $this->assertFalse($message);
 }
 /**
  *
  */
 public function testSendMailableException()
 {
     if (!class_exists('Swift_NullTransport')) {
         return;
     }
     $transport = new \Swift_NullTransport();
     $exception = (new MailWrapperMailableException())->setParams(['test1' => 'test2']);
     MailManager::sendExceptionTo('*****@*****.**', '*****@*****.**', $exception, '*****@*****.**', $transport);
 }
 /**
  *
  */
 public function testSendViaWrapped()
 {
     $transport = new \Swift_NullTransport();
     $mailer = new \Swift_Mailer($transport);
     $message = MailManager::getMailMessage('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**');
     MailManager::sendVia($mailer, $message);
 }
 /**
  * @param $address
  * @return bool
  */
 public function addToRecipient($address)
 {
     if (!$address) {
         return false;
     }
     if (!($address = MailManager::isEmailAddress($address))) {
         return false;
     }
     if (in_array($address, $this->toRecipients)) {
         return false;
     }
     $this->toRecipients[] = $address;
     return true;
 }
 /**
  * @expectedException \BespokeSupport\MailWrapper\MailWrapperSetupException
  */
 public function testSendViaFail()
 {
     $message = MailManager::getMailMessage('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**');
     MailManager::sendVia($message, null);
 }
 /**
  * @expectedException \BespokeSupport\MailWrapper\MailWrapperSetupException
  */
 public function testSendExceptionSetup()
 {
     $transport = new TesterTransportPhpMailerNull(true);
     MailManager::send($transport);
 }
Esempio n. 7
0
 /**
  *
  */
 public function testSend()
 {
     $transport = new InMemory();
     $message = new Message();
     MailManager::send($message, $transport);
 }
Esempio n. 8
0
 /**
  * @expectedException \BespokeSupport\MailWrapper\MailWrapperSetupException
  */
 public function testExceedEmails()
 {
     $apiKey = 'key';
     $domain = 'example.com';
     $manager = new MailgunManager($apiKey, $domain);
     $toMails = [];
     for ($i = 0; $i <= 1001; $i++) {
         $toMails[] = $i . '*****@*****.**';
     }
     $message = MailManager::getMailMessage('*****@*****.**', '*****@*****.**', '*****@*****.**', $toMails);
     MailManagerSendMailgun::send($manager, $message);
 }