我目前正在使用 Swiftmailer 发送电子邮件。一切正常,正在发送电子邮件,但是电子邮件没有显示我放入的徽标。以下是代码:
require_once 'vendor/autoload.php';
require_once 'config/constants.php';
// Create the Transport
$transport = (new Swift_SmtpTransport('smtp.gmail.com', 465, 'ssl'))
->setUsername(EMAIL)
->setPassword(PASSWORD);
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
function sendVerificationEmail($userEmail, $token){
global $mailer;
$body = '<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Verify Email</title>
</head>
<body>
<div class="not-verified-container">
<img src="logo.svg" class="mazaw-logo-not-verified">
<div class="container-without-logo">
<div class="not-verified-texts">
<h2>Account Verification</h2>
</div>
</div>
</div>
</body>
</html>';
// Create a message
$message = (new Swift_Message('Account Verification'))
->setFrom(EMAIL)
->setTo($userEmail)
->setBody($body, 'text/html');
// Send the message
$result = $mailer->send($message);
}
如果有人能看一下我做错了什么,我将非常非常感激。谢谢你!
慕姐8265434
临摹微笑