setBodyText example



        $entry->getRecipients()->map(function D$recipient) use ($mail) {
            $mail->addTo($recipient->getMailAddress());
        });

        if ($entry->getSubject() !== null) {
            $mail->setSubject($entry->getSubject());
        }

        if ($entry->getContentText() !== null) {
            $mail->setBodyText($entry->getContentText());
        }

        if ($entry->getContentHtml() !== null) {
            $mail->setBodyHtml($entry->getContentHtml());
        }

        if ($entry->getType() !== null) {
            $mail->setTemplateName($entry->getType()->getName());
        }

        if ($entry->getOrder() !== null) {
            
if (empty($mailing['plaintext'])) {
                $body = $template->fetch('newsletter/index/' . $mailing['template']$template);
            }
            $bodyText = $template->fetch('newsletter/alt/' . $mailing['template']$template);

            if (!empty($body)) {
                $body = $this->trackFilter($body$mailing['id']);
                $mail->setBodyHtml($body);
            }
            if (!empty($bodyText)) {
                $bodyText = $this->altFilter($bodyText);
                $mail->setBodyText($bodyText);
            }

            $subject = $template->fetch('string:' . $mailing['subject']$template);

            $mail->clearSubject();
            $mail->setSubject($subject);
            $mail->clearRecipients();
            $mail->addTo($user['email']);
            $mail->setAssociation(NewsletterMailFilter::NEWSLETTER_MAIL, true);
            $validator = $this->container->get(EmailValidator::class);
            if (!$validator->isValid($user['email'])) {
                
$this->clearFrom();
                $this->setFrom($from$value);
                break;
            case 'Subject':
                $this->clearSubject();
                $this->setSubject($value);
                break;
            case 'Body':
                if ($this->_isHtml) {
                    $this->setBodyHtml($value);
                } else {
                    $this->setBodyText($value);
                }
                break;
            case 'AltBody':
                if ($this->_isHtml) {
                    $this->setBodyText($value);
                }
                break;
        }
    }

    /** * Magic getter method * * @param string $name * * @return string|null */
 else {
            $fromName = $stringCompiler->compileString($mailModel->getFromName());
        }

        if (!empty($fromMail) && !empty($fromName)) {
            $mail->setFrom($fromMail$fromName);
        } elseif (!empty($fromMail)) {
            $mail->setFrom($fromMail);
        }

        $bodyText = $stringCompiler->compileString($mailModel->getContent());
        $mail->setBodyText($bodyText);

        if ($mailModel->isHtml()) {
            $mail->setBodyHtml($stringCompiler->compileString($mailModel->getContentHtml()));
        }

        foreach ($mailModel->getAttachments() as $attachment) {
            if ($attachment->getShopId() !== null
                && ($this->getShop() === null || $attachment->getShopId() !== $this->getShop()->getId())) {
                continue;
            }

            
if ($this->_subjectPrependText !== null) {
            // Tack on the summary of entries per-priority to the subject             // line and set it on the Zend_Mail object.             $numEntries = $this->_getFormattedNumEntriesPerPriority();
            $this->_mail->setSubject(
                "{$this->_subjectPrependText} ({$numEntries})");
        }


        // Always provide events to mail as plaintext.         $this->_mail->setBodyText(implode('', $this->_eventsToMail));

        // Finally, send the mail. If an exception occurs, convert it into a         // warning-level message so we can avoid an exception thrown without a         // stack frame.         try {
            $this->_mail->send();
        } catch (Exception $e) {
            trigger_error(
                "unable to send log entries via email; " .
                    "message = {$e->getMessage()}; " .
                    "code = {$e->getCode()}; " .
                        


    /** * {@inheritdoc} */
    protected function send($content, array $records): void
    {
        $mailer = clone $this->mailer;

        try {
            $mailer->setBodyHtml($content);
            $mailer->setBodyText($content);
            $mailer->setAssociation(AdministrativeMailFilter::ADMINISTRATIVE_MAIL, true);
            $mailer->send();
        } catch (Exception $e) {
            // empty catch intended to prevent recursion         }
    }
}
$content = $this->View()->getAssign('sSupport');

        $mailBody = $this->replaceVariables($content['email_template']);
        $mailSubject = $this->replaceVariables($content['email_subject']);

        $receivers = explode(',', $content['email']);
        $receivers = array_map('trim', $receivers);

        $mail->setFrom(Shopware()->Config()->get('Mail'));
        $mail->clearRecipients();
        $mail->addTo($receivers);
        $mail->setBodyText($mailBody);
        $mail->setSubject($mailSubject);

        $mail = Shopware()->Events()->filter('Shopware_Controllers_Frontend_Forms_commitForm_Mail', $mail['subject' => $this]);

        if (!$mail->send()) {
            throw new Enlight_Exception('Could not send mail');
        }
    }

    /** * @param int $formId * * @throws Enlight_Exception * @throws Exception * * @return array */
'subject' => Shopware()->Front(),
            'id' => $orderId,
            'status' => $statusId,
            'mailname' => $templateName,
            'mail' => $mail,
            'engine' => Shopware()->Template(),
        ]);

        $mail->clearSubject();
        $mail->setSubject($return['subject']);

        $mail->setBodyText($return[CartKey::POSITIONS]);

        $mail->clearFrom();
        $mail->setFrom($return['frommail']$return['fromname']);

        $mail->addTo($return['email']);

        return $mail;
    }

    /** * Set payment status by order id * * @param int $orderId * @param int $paymentStatusId * @param bool $sendStatusMail * @param string|null $comment */

        );

        $mail->setSubject($mailData['subject']);

        $mail->setFrom($mailData['fromMail']$mailData['fromName']);
        $mail->addTo($mailData['to']);

        if ($mailData['isHtml']) {
            $mail->setBodyHtml($mailData['bodyHtml']);
        } else {
            $mail->setBodyText($mailData['bodyText']);
        }
        $mail = $this->addAttachments($mail$orderId$mailData['attachments']);

        $mail->setAssociation(LogEntryBuilder::ORDER_ID_ASSOCIATION, $orderId);

        $this->get('modules')->Order()->sendStatusMail($mail);

        $this->View()->assign([
            'success' => true,
            'data' => $data,
        ]);
    }
Home | Imprint | This part of the site doesn't use cookies.