private function headers()
 {
     $headers = new Headers();
     $messageId = new MessageId();
     $messageId->setId('testId');
     $headers->addHeader($messageId);
     $addressList = new AddressList();
     $addressList->add('*****@*****.**');
     $from = new From();
     $from->setAddressList($addressList);
     $headers->addHeader($from);
     $to = new To();
     $to->setAddressList($addressList);
     $headers->addHeader($to);
     return $headers;
 }
示例#2
0
 protected function getRecipients(Support $issue)
 {
     $em = $this->getContainer()->get('doctrine.orm.entity_manager');
     $repo = $em->getRepository('ActsCamdramSecurityBundle:User');
     $issueFrom = From::fromString('From:' . $issue->getFrom())->getAddressList()->current();
     $recipients = array();
     if ($issue->getOriginal()->getOwner()) {
         //The issue has an owner, so just include the issue owner
         $owner = $issue->getOriginal()->getOwner();
         if ($issueFrom->getEmail() != $owner->getFullEmail()) {
             $recipients[$owner->getFullEmail()] = $owner->getName();
         }
     } else {
         //No owner, so include all admins
         $admins = $repo->findAdmins(AccessControlEntry::LEVEL_FULL_ADMIN);
         foreach ($admins as $admin) {
             if ($issueFrom->getEmail() != $admin->getFullEmail()) {
                 $recipients[$admin->getFullEmail()] = $admin->getName();
             }
         }
     }
     //Also include the original sender and receiver
     $from = From::fromString('From:' . $issue->getOriginal()->getFrom());
     $to = To::fromString('To:' . $issue->getOriginal()->getTo());
     foreach (array($from, $to) as $email) {
         /** @var $email \Zend\Mail\Header\AbstractAddressList */
         foreach ($email->getAddressList() as $address) {
             if (strpos($address->getEmail(), '@camdram.net') === false && $address->getEmail() != $issueFrom->getEmail()) {
                 $recipients[$address->getEmail()] = $address->getName();
             }
         }
     }
     return $recipients;
 }
 private function headers()
 {
     $headers = new Headers();
     $messageId = new MessageId();
     $messageId->setId('testId');
     $headers->addHeader($messageId);
     $addressList = new AddressList();
     $addressList->add('*****@*****.**', 'Dummy Name');
     $from = new From();
     $from->setAddressList($addressList);
     $headers->addHeader($from);
     $to = new To();
     $to->setAddressList($addressList);
     $headers->addHeader($to);
     //@todo fix this;
     $contentTransferEncoding = new GenericHeader("Content-Transfer-Encoding", "7bit");
     $headers->addHeader($contentTransferEncoding);
     return $headers;
 }