Answer the question
In order to leave comments, you need to log in
An unknown way to insert inline pictures into emails?
I received a newsletter on gmail the other day and saw the pictures right away, without any “Show pictures” there, and for some reason I looked at the source. I thought that there was a regular attachment with Content-Disposition: inline and links to it in the body of the letter. But I saw something different. Attached pictures were formatted like this:
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
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('[email protected]'=>'R2D2'));
$message->setTo('[email protected]', 'C3PO');
$body='<img src=" example.com/image.jpg ">';
$message->setBody($body, 'text/html');
$attach=Swift_Attachment::fromPath('/home/example/htdocs/image.jpg');
example.com/image.jpg ');
$message->attach($attach);
$mailer->send($message);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question