Ejemplo n.º 1
0
 /**
  * Add an unsubscribe email to the List-Unsubscribe header if applicable
  *
  * @param Events\EmailSendEvent $event
  */
 public function onEmailSend(Events\EmailSendEvent $event)
 {
     if ($unsubscribeEmail = $event->getHelper()->generateUnsubscribeEmail()) {
         $headers = $event->getTextHeaders();
         $existing = isset($headers['List-Unsubscribe']) ? $headers['List-Unsubscribe'] : '';
         $unsubscribeEmail = "<mailto:{$unsubscribeEmail}>";
         $updatedHeader = $existing ? $unsubscribeEmail . ", " . $existing : $unsubscribeEmail;
         $event->addTextHeader('List-Unsubscribe', $updatedHeader);
     }
 }