Question

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.

Pas de solution correcte

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top