How to embed images in html email

0 votes
I'm trying to implement a code to send HTML email with embedded image.

I already tried for simple HTML email with image but this image is taken from server.
Nov 23, 2020 in PHP by kartik
• 37,490 points
61 views

1 answer to this question.

0 votes

Hello @kartik,

PHPMailer has the ability to automatically embed images from your HTML email. You have to give full path in the file system, when writing your HTML:

<img src="/var/www/host/images/photo.png" alt="my photo" />

It will automaticaly convert to:

<img src="cid:photo.png" alt="my photo" />

Hope it helps!!

answered Nov 23, 2020 by Niroj
• 82,540 points

Related Questions In PHP

0 votes
1 answer

How to check if a string is an email address in PHP?

Hello, Try this without regular expressions: <?php ...READ MORE

answered Nov 3, 2020 in PHP by Niroj
• 82,540 points
121 views
0 votes
1 answer

How to embed PHP code in JavaScript?

Hello, If your whole JavaScript code gets processed ...READ MORE

answered Nov 9, 2020 in PHP by anonymous
• 82,540 points
452 views
0 votes
1 answer

How to embed a .png image into an html page?

Hello @kartik, Try this: div.image { width:100px; ...READ MORE

answered Nov 16, 2020 in PHP by Niroj
• 82,540 points
54 views
0 votes
1 answer

How to send email using php?

Hello @kartik 1.) Download PHPMailer, open the zip file ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,540 points
171 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,540 points
4,824 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,540 points
547 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,540 points
411 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,540 points
5,444 views
0 votes
1 answer

How to send email with PHPMailer - embed image in body?

Hello @kartik, I found the answer: $mail->AddEmbeddedImage('img/2u_cs_mini.jpg', 'logo_2u'); and on ...READ MORE

answered Oct 22, 2020 in PHP by Niroj
• 82,540 points
540 views
0 votes
1 answer

How to make PDF file downloadable in HTML link?

Hello @kartik, Try this: <a href="./directory/yourfile.pdf" download="newfilename">Download the pdf</a> Where newfilename is ...READ MORE

answered Aug 27, 2020 in PHP by Niroj
• 82,540 points
2,124 views