문제

For some reason, if I use the following code, only one image seems to get sent:

$sql = mysql_query("SELECT photo FROM article_info");
while($row = mysql_fetch_assoc($sql)) {
    $mime->addHTMLImage($row['photo']);
}

But if I were to manually enter each image:

$mime->addHTMLImage("path_to/image1.jpg");
$mime->addHTMLImage("path_to/image2.jpg");

Both images will be sent. Now what's interesting is that with the first piece of code, the image that gets sent though email is image2.jpg. Like if for some reason, $mime gets overwritten, or something. Am I doing something wrong? Why would I only be sending/receiving one image? Any suggestions? Thanks in advance.

올바른 솔루션이 없습니다

다른 팁

You need to specify the name of the image as third parameter. Currently, the name is empty and thus you overwrite the image-without-a-name with the new image-without-a-name.

http://pear.php.net/manual/en/package.mail.mail-mime.addhtmlimage.php

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top