public function executeBeforeLastRedirect($node)
 {
     $survey = $this->fetchFeedbackSurvey();
     $surveyQuestions = $this->feedbackQuestionList();
     $mailTo = $this->fetchMailTo($surveyQuestions);
     if ($survey = $this->fetchFeedbackSurvey() and $survey instanceof eZSurvey and $surveyQuestions = $this->feedbackQuestionList() and $mailTo = $this->fetchMailTo($surveyQuestions) and eZMail::validate($mailTo)) {
         $tpl_email = eZTemplate::factory();
         $tpl_email->setVariable('intro', $this->Text2);
         $tpl_email->setVariable('survey', $survey);
         $tpl_email->setVariable('survey_questions', $surveyQuestions);
         $tpl_email->setVariable('survey_node', $node);
         $templateResult = $tpl_email->fetch('design:survey/feedbackfield_mail.tpl');
         if (trim($this->Text3) != '') {
             $subject = $this->Text3;
         } else {
             $subject = $tpl_email->variable('subject');
         }
         $mail = new eZMail();
         $ini = eZINI::instance();
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
         }
         $mail->setSenderText($emailSender);
         $mail->setReceiver($mailTo);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         if ($this->Num == 1) {
             $adminReceiver = $ini->variable('MailSettings', 'AdminEmail');
             $mail->addBcc($adminReceiver);
         }
         $mailResult = eZMailTransport::send($mail);
     }
 }
Esempio n. 2
0
 /**
  * See site.ini [MailSettings] ExcludeHeaders
  */
 public function testExcludeHaders()
 {
     self::markTestSkipped("Tests needs to use other email addresses");
     ezpINIHelper::setINISetting('site.ini', 'MailSettings', 'Transport', 'SMTP');
     ezpINIHelper::setINISetting('site.ini', 'MailSettings', 'ExcludeHeaders', array('bcc'));
     $mail = new eZMail();
     $mail->setReceiver('*****@*****.**', 'John Doe');
     $mail->setSender('*****@*****.**', 'Jane Doe');
     $mail->addBcc('*****@*****.**', 'Jim Doe');
     $mail->setSubject('Testing ExcludeHeaders');
     $mail->setBody('Jim should not get this email.');
     // BCC should be set at this point
     $this->assertTrue(strpos($mail->Mail->generateHeaders(), 'Bcc: Jim Doe <*****@*****.**>') > 0);
     // We don't care if the mail gets sent. What's important is what happens to the headers.
     eZMailTransport::send($mail);
     // BCC should not be set anymore at this point, because of ExcludeHeaders
     $this->assertFalse(strpos($mail->Mail->generateHeaders(), 'Bcc: Jim Doe <*****@*****.**>') > 0);
 }
Esempio n. 3
0
         $ccReceivers = array($ccReceivers);
     }
     foreach ($ccReceivers as $ccReceiver) {
         if ($mail->validate($ccReceiver)) {
             $mail->addCc($ccReceiver);
         }
     }
 }
 // Handle BCC recipients
 if ($bccReceivers) {
     if (!is_array($bccReceivers)) {
         $bccReceivers = array($bccReceivers);
     }
     foreach ($bccReceivers as $bccReceiver) {
         if ($mail->validate($bccReceiver)) {
             $mail->addBcc($bccReceiver);
         }
     }
 }
 $mail->setSubject($subject);
 //BEGIN ENHANCED BINARY EXTENSION MAIL CODE ADDITION
 $fileAttachments = array();
 foreach (array_keys($contentObjectAttributes) as $key) {
     if ($contentObjectAttributes[$key]->DataTypeString == "enhancedezbinaryfile") {
         $id = $contentObjectAttributes[$key]->attribute('id');
         $xmlText = $collectionAttributes[$id]->DataText;
         if (trim($xmlText) != '') {
             $dom = new DOMDocument('1.0', 'utf-8');
             if ($dom->loadXML($xmlText)) {
                 $OriginalFilename = $dom->getElementsByTagName('OriginalFilename')->item(0)->textContent;
                 $FileType = $dom->getElementsByTagName('Type')->item(0)->textContent;
Esempio n. 4
0
 public function testRegressionBccAll()
 {
     $mail = new eZMail();
     $mail->addBcc($this->adminEmail, $this->adminName);
     $ezpResult = $mail->bccElements();
     $ezcResult = $mail->Mail->bcc;
     $ezpExpected = array(array('email' => $this->adminEmail, 'name' => $this->adminName));
     $ezcExpected = array(new ezcMailAddress($this->adminEmail, $this->adminName));
     $this->assertEquals($ezpExpected, $ezpResult);
     $this->assertEquals($ezcExpected, $ezcResult);
 }