PHP email with image

Hi! When I display my email content in browser it display the table with images, but when I send the mail it doesn’t display the images.
I want to send in email this table:
$categories = count($idProdus);
table:
echo “< table>”;
for ($i = 0; $i < $categories; $i++)
{
echo " < tr> ";
echo " < td > {$image[$i]} < / td > ";
echo ‘< /tr>’;
echo ‘< /table>’;
}

Before your image could be shown in your mail client you have to add the raw image data to the email as an attachment OR use a full URL (like https://mydomain.com/images/image1.jpg) so that your client can download the image. Last method sucks most time because email clients want to protect you being tracked and thus refuses to download the image from a third party webserver by default.

To use the first method i must highly recommend to use a library like PHPMailer. There is a lot of information that you can find allover the worldwide web how to install and use it.

Sponsor our Newsletter | Privacy Policy | Terms of Service