Swift Mailer Header - PullRequest
       81

Swift Mailer Header

0 голосов
/ 24 февраля 2020

У меня есть следующий Swift Mailer PHP рутина

<?php
$sname = "First Last";
$sstartdate = "02/02/2020";
$senddate = "02/29/2020";

    $message .= '<p><strong>CAMP REGISTRATION EMAIL CONFIRMATION</strong></p>';
    $message .= '<p><strong>Camp:</strong>' . $sname . '<br>';
    $message .= '<strong>Dates:</strong>' . $sstartdate . ' thru ' . $senddate . '</p>';
    $message .= '<p>This email confirms your registration for the above camp, retreat or conference.</p><p style="color: red;">Please remember that a copy of the applicant insurance card and a copy of the applicant immunization records must can be sent to us by mail to: 333 Cedine Camp Road, Spring City, TN 37381, or emailed to us at confreg@cedine.org. Please include your child\'s full name and the name and dates of the camp they are attending.</p><p style="color: red;">Your registration is not complete until your camp fees have been received.</p><p style="text-align: left; font-size: 11px;">' . date('D, m-d-Y, h:i:s a') . '</p>';
    $message .= '<p><a href="https://www.cedine.org">Cedine Ministires</a></p>';



print "<hr>$message</hr>";

// send emails 
// https://swiftmailer.symfony.com/docs/sending.html
// tls = 587 or 465
    require_once ("../swift/lib/swift_required.php");
    $emails = array('jsnull@outlook.com');
    //$themessage = "<p><strong>Cedine Website</strong></p>";

    foreach ($emails as $email){
            $transport = Swift_SmtpTransport::newInstance('mail.authsmtp.com', 587, 'tls')
                 ->setUsername('xxxxxxxxxxxxxxx')
                 ->setPassword('xxxxxxxxxxxxxxxxxxx');

            $mailer = Swift_Mailer::newInstance($transport);

            $message = Swift_Message::newInstance('Registration Email From Website')
                  ->setFrom(['info@cedine.org' => 'Cedine Registration'])
                  ->setTo(array($email))
                  ->setBody($message, 'text/html');

            $mailresult = $mailer->send($message);
    }

print "<hr>$message</hr>";

?>

Отображение сообщения $ после добавления кода

Идентификатор сообщения: Дата: Пн , 24 февраля 2020 11:51:42 -0500 Тема: электронная почта регистрации с веб-сайта от: Cedine Регистрация до: jsnull@outlook.com MIME-версия: 1.0 Content-Type: text / html; charset = utf-8 Content-Transfer-Encoding: цитируемая для печати

к сообщению $ ... как мне предотвратить это?

См .: https://cedine.org/register/testemails.php

1 Ответ

0 голосов
/ 24 февраля 2020

Я решил свою проблему, изменив это .....

$message = Swift_Message::newInstance('Registration Email From Website')
              ->setFrom(['info@cedine.org' => 'Cedine Registration'])
              ->setTo(array($email))
              ->setBody($message, 'text/html');

На это .....

$newmessage = Swift_Message::newInstance('Registration Email From Website')
              ->setFrom(['info@cedine.org' => 'Cedine Registration'])
              ->setTo(array($email))
              ->setBody($newmessage, 'text/html');
...