首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Swift Mailer标题

Swift Mailer标题
EN

Stack Overflow用户
提问于 2020-02-25 00:56:48
回答 1查看 34关注 0票数 0

我有以下Swift Mailer PHP例程

代码语言:javascript
复制
<?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>";

?>

在代码添加后显示$message

Message-ID: Date: Mon,24 Feb 2020 11:51:42 -0500主题:注册电子邮件来自网站: Cedine注册收件人: jsnull@outlook.com MIME-Version: 1.0内容类型:文本/html;字符集=utf-8内容传输编码: quoted-printable

去$message ..。我如何防止这种情况发生?

请参阅:https://cedine.org/register/testemails.php

EN

回答 1

Stack Overflow用户

发布于 2020-02-25 01:31:04

我通过改变这个来解决我自己的问题……

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

对此……

代码语言:javascript
复制
$newmessage = Swift_Message::newInstance('Registration Email From Website')
              ->setFrom(['info@cedine.org' => 'Cedine Registration'])
              ->setTo(array($email))
              ->setBody($newmessage, 'text/html');
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60380626

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档