首页 > 解决方案 > Symfony 5 Mailer 发送带有个人资料图片的邮件

问题描述

所以我正在尝试使用我的提供商的 smtp 服务器从 symfony 发送电子邮件。

一切正常。但现在我要做的是在发送电子邮件中将我的个人资料图片显示为头像(而不是那个头像)

电子邮件头像示例

我正在使用基本的邮件程序 sendEMail() 功能:

$message = (new \Swift_Message('Hello Email'))
        ->setFrom('send@example.com')
        ->setTo('recipient@example.com')
        ->setBody(
            $this->renderView(
                // templates/emails/registration.html.twig
                'emails/registration.html.twig',
                ['name' => $name]
            ),
            'text/html'
        );

        // you can remove the following code if you don't define a text version for your emails
       

    $mailer->send($message);

提前致谢。

标签: symfonysmtpmailersymfony5

解决方案


推荐阅读