Beispiel #1
0
 /**
  * When the mailing is set, we need to take some features over from the mailing to the email.
  *
  * @param \Mailing\Entity\Mailing $mailing
  */
 public function setMailing($mailing)
 {
     $this->mailing = $mailing;
     if (is_null($this->email)) {
         throw new \RuntimeException("The email object is empty. Did you call create() first?");
     }
     $this->email->setFrom($this->mailing->getSender()->getEmail());
     $this->email->setFromName($this->mailing->getSender()->getSender());
     $this->email->setSubject($this->mailing->getMailSubject());
     $this->email->setHtmlLayoutName($this->mailing->getTemplate()->getTemplate());
     $this->email->setMessage($this->mailing->getMailHtml());
 }
Beispiel #2
0
 /**
  * When the mailing is set, we need to take some features over from the mailing to the email.
  *
  * @param \Mailing\Entity\Mailing $mailing
  */
 public function setMailing($mailing)
 {
     $this->mailing = $mailing;
     if (is_null($this->email)) {
         throw new \RuntimeException("The email object is empty. Did you call create() first?");
     }
     //There is a special case when the mail is sent on behalf of the user. The sender is then called _self
     if ($this->mailing->getSender()->getEmail() === '_self') {
         if ($this->getAuthenticationService()->hasIdentity()) {
             $this->email->setFrom($this->getAuthenticationService()->getIdentity()->getEmail());
             $this->email->setFromName($this->getAuthenticationService()->getIdentity()->getDisplayName());
         } else {
             $this->email->setFrom($this->mailing->getContact()->getEmail());
             $this->email->setFromName($this->mailing->getContact()->getDisplayName());
         }
     }
     $this->email->setSubject($this->mailing->getMailSubject());
     $this->email->setHtmlLayoutName($this->mailing->getTemplate()->getTemplate());
     $this->email->setMessage($this->mailing->getMailHtml());
 }