在 php 中发送邮件,如果在邮件中图片按理来加 img 标签在 src 写图片路径就可以了
// 发邮件给用户
include_once($_SERVER["DOCUMENT_ROOT"] . '/PHPMailer/class.phpmailer.php');
$mail = new PHPMailer();
// 图片附件
$imageUrl = dirname('https://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]) . '/image/';
$picArr = array(
'fb' => $imageUrl . "icon-fb.png",
'in' => $imageUrl . "icon-in.png",
'wc' => $imageUrl . "icon-wc.png"
);
// 邮件内容
$mail->isHTML(true);
$mail->CharSet = 'UTF-8';
$mail->From = "test";
$mail->FromName = 'test';
$mail->AddAddress("[email protected]");
$mail->AddCC("[email protected]");
$mail->Subject = "测试";