'How to prevent phpmailer sending embedded image as an attachment on Gmail?
I am sending an email with the logo of a company in it. However, I find it annoying when it shows the .png file on the list of emails on Gmail. Upon clicking the email, the logo is there and there's no attachment (which is good). But I really need to remove the file when viewing on the email list. See the image below.
is there a way where I can remove this "email-logo.png"?
.
.
$mail->AddEmbeddedImage('img/email-logo.png','logo');
.
.
$mail->Body = "<img src='cid:logo'>";
.
.
Solution 1:[1]
You can try using
$mail->clearAttachments();
Solution 2:[2]
I resolved to putting the src attribute of the image to a remote link e.g src="http://somesite.com/image.png"
. I resolved to this since I always saw embedded images always coming as attachments as you have mentioned. But some clients block remote content as I have seen with this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Paulo Moreira |
Solution 2 | Henry Ecker |