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)!
Shop7z网上购物系统是基于ASP开发的简单易用的商城建站平台,Shop7z可以满足不同企业、个人的各种网上开店需求!普及版是一套简便易用的商城系统,支持商品图片批量上传、淘宝导入、商品批量修改等实用功能,还支持手机版以及APP的整合,普及版支持4种不同的模板风格,支持支付宝、财付通、网银在线等支付接口,系统还支持新订单邮件通知、多种分类排序、商品归属多分类等功能,支持五种会员价格体系等。
0
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号