简体   繁体   English

通过脚本发送的电子邮件中的图片

[英]Picture in the email send by script

Good morning. 早上好。 This is my first post so please forgive me for any mistakes. 这是我的第一篇文章,因此任何错误请原谅。 I am using PHPMailer for sending emails and it works perfect. 我正在使用PHPMailer发送电子邮件,它运行完美。 However... I created php script which does a select query on SQL Server DB and sends email to users with reminder. 但是...我创建了php脚本,该脚本在SQL Server DB上执行选择查询,并通过提醒将电子邮件发送给用户。 If I run this script directly from browser, emails with embedded picture are sent without problems, but if I run this php file using .bat file emails are sent without a picture - just red cross in place where the picture should be. 如果我直接从浏览器运行此脚本,则发送带有嵌入图片的电子邮件没有问题,但是,如果我使用.bat文件运行此php文件,则发送的电子邮件没有图片-仅在图片应有的地方出现红叉。 To attach a picture I am using: 要附加图片,我正在使用:

$mail->AddEmbeddedImage("images/logo.jpg","logo","logo.jpg")

and in the email body: 并在电子邮件正文中:

<img src="cid:logo">

Any ideas why a picture is not attached when php is ran from the bat file? 从bat文件运行php时为什么没有附加图片的任何想法? thanks LukaszKU 谢谢LukaszKU

您应该指定图像的完整路径,例如:/ /usr/home/user/.../images/logo.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM