function embed_images(&$body)
{
// get all img tags
preg_match_all('//', $body, $matches);
if (!isset($matches[0])) return;
// foreach tag, create the cid and embed image
$i = 1;
foreach ($matches[0] as $img)
{
// make cid
$id = 'img'.($i++);
// replace image web path with local path
preg_match('/src="(.*?)"/', $body, $m);
if (!isset($m[1])) continue;
$arr = parse_url($m[1]);
if (!isset($arr['host']) || !isset($arr['path']))continue;
// add
$this->AddEmbeddedImage('/home/username/'.$arr['host'].'/
public'.$arr['path'], $id, 'attachment', 'base64', 'image/jpeg');
$body = str_replace($img, '', $body);
}
}
以上就是PHPMailer 在邮件中嵌入图片的内容,更多相关内容请关注PHP中文网(www.php.cn)!
如果您是新用户,请直接将本程序的所有文件上传在任一文件夹下,Rewrite 目录下放置了伪静态规则和筛选器,可将规则添加进IIS,即可正常使用,不用进行任何设置;(可修改图片等)默认的管理员用户名、密码和验证码都是:yeesen系统默认关闭,请上传后登陆后台点击“核心管理”里操作如下:进入“配置管理”中的&ld
0
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号