Unknown ways to insert inline images in emails?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
50 views
f190d226.png

Recently received a newsletter in gmail and saw the images immediately, without any "Show images" and for some reason I looked at the source. I thought that there normal enclosure with a Content-Disposition: inline and reference it in the body. But saw something different. Pratasenya pictures were designed:


Copy Source
|
Copy HTML



Content-Type: image/jpeg; name=image.jpg

Content-Transfer-Encoding: base64

Content-Disposition: attachment; filename=image.jpg

Content-Location: example.com/image.jpg





And the message body was just tags imageexample.com/image.jpg">


Tried to reproduce using SwiftMailer'a:

Copy Source
|
Copy HTML


$transport = Swift_SmtpTransport::newInstance();
$transport->setUsername('login');
$transport->setPassword('password');


$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance();
$message->setSubject('Hello man!');
$message->setFrom(array('r2d2@example.com'=>'R2D2'));
$message->setTo('c3po@example.com', 'C3PO');


$body='imageexample.com/image.jpg">';
$message->setBody($body, 'text/html');


$attach=Swift_Attachment::fromPath('/home/example/htdocs/image.jpg');
// to the normal attach add a Content-Location header
$attach->getHeaders()->addTextHeader('Content-Location', 'example.com/image.jpg');


$message->attach($attach);
$mailer->send($message);





It works, images are loaded in a letter once a server is requested as attache not shown. Tested in gmail and outlook 2007. Checked all the rfc I found — never seen mention of such. For rfc to insert inline images you need to use Content-Disposition: inline Content-ID


Question: why does it work?

By the way, gmail always show inline images from?
by | 50 views

2 Answers

0 like 0 dislike
This is from RFC 2616, podrazdel 14.14.
by
0 like 0 dislike
But this is rfc for HTTP, I do not understand how it is associated with the letters?
And in HTTP, read, can not understand how this header is used. Can you give an example?
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 1, 2019 by DensDens
110,608 questions
257,186 answers
0 comments
27,924 users