addCc() public method

Adds Cc-header and recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
public addCc ( string | array $email, string $name = '' ) : Pimcore_Mail
$email string | array
$name string
return Pimcore_Mail Provides fluent interface
Ejemplo n.º 1
0
 /**
  * Resends the email to the recipients
  */
 public function resendEmailAction()
 {
     if (!$this->getUser()->isAllowed("emails")) {
         throw new \Exception("Permission denied, user needs 'emails' permission.");
     }
     $success = false;
     $emailLog = Tool\Email\Log::getById($this->getParam('id'));
     if ($emailLog instanceof Tool\Email\Log) {
         $mail = new Mail();
         $mail->preventDebugInformationAppending();
         if ($html = $emailLog->getHtmlLog()) {
             $mail->setBodyHtml($html);
         }
         if ($text = $emailLog->getTextLog()) {
             $mail->setBodyText($text);
         }
         $mail->setFrom($emailLog->getFrom());
         foreach ($emailLog->getToAsArray() as $entry) {
             $mail->addTo($entry['email'], $entry['name']);
         }
         foreach ($emailLog->getCcAsArray() as $entry) {
             $mail->addCc($entry['email'], $entry['name']);
         }
         foreach ($emailLog->getBccAsArray() as $entry) {
             $mail->addBcc($entry['email']);
         }
         $mail->setSubject($emailLog->getSubject());
         $mail->send();
         $success = true;
     }
     $this->_helper->json(array("success" => $success));
 }