/**
  * @param string $email
  * @param string $token
  *
  * @return \Generated\Shared\Transfer\SendMailResponsesTransfer
  */
 public function send($email, $token)
 {
     $mailTransfer = new MailTransfer();
     $mailRecipientTransfer = new MailRecipientTransfer();
     $mailRecipientTransfer->setEmail($email);
     $mailTransfer->addRecipient($mailRecipientTransfer);
     $mailTransfer->setSubject(static::SUBJECT);
     $mailTransfer->setTemplateName(static::TEMPLATE);
     $mailTransfer->setMerge(true);
     $mailTransfer->setMergeLanguage('handlebars');
     $mailTransfer->setGlobalMergeVars(['reset_password_token' => $token]);
     $this->getFactory()->getMailFacade()->sendMail($mailTransfer);
 }
Ejemplo n.º 2
0
 /**
  * @return void
  */
 public function testSendMailContainsMerge()
 {
     $mailTransfer = new MailTransfer();
     $mailTransfer->setMerge(true);
     $this->mandrillMock->messages->expects($this->once())->method('sendTemplate')->with($this->anything(), $this->anything(), $this->arrayContainsKeyEqualTo('merge', true), $this->anything(), $this->anything(), $this->anything());
     $this->mailSender->sendMail($mailTransfer);
 }
 /**
  * @param \Generated\Shared\Transfer\MailTransfer $mailTransfer
  * @param array $globalMergeVars
  *
  * @return void
  */
 protected function setMailMergeData(MailTransfer $mailTransfer, array $globalMergeVars = [])
 {
     $mailTransfer->setMerge(true);
     $mailTransfer->setMergeLanguage($this->getMergeLanguage());
     $mailTransfer->setGlobalMergeVars($globalMergeVars);
 }