您好我试图在电子邮件中嵌入图片,这是我的PHP代码:
$mail1->SMTPDebug = 2;
$mail1->isSMTP();
$mail1->Host = 'smtp.gmail.com';
$mail1->SMTPAuth = true;
$mail1->Username = 'email@gmail.com';
$mail1->Password = 'password';
$mail1->SMTPSecure = 'tls';
$mail1->Port = 587;
$mail1->setFrom('auto-reply@email.ca', '123');
$mail1->addAddress('email@gmail.com');
$mail1->isHTML(true);
$mail1->Subject = 'Thanks For Reaching us!';
$mail1->Body = '
<p> This is a test picture <img src="img/logo.png"/> </p>
' ;
$mail1->send();
exit;
当我在本地主机上运行此代码时,电子邮件会显示文字,但图片的标志已经破损,我已经尝试了一路,包括
$mail1->AddEmbeddedImage('img\logo.png', "two", "logo.png");
然而,它根本没有显示图像,任何人都知道如何解决这个问题?