[RCD] Embed images into message source

Rosali myroundcube at mail4us.net
Mon Oct 22 09:27:19 CEST 2012

Hi all,

If users embed image tags ...

alt="" />

... into HTML messages these images will be blocked by Roundcube and 
most other email clients by default (that's fine due to privacy 

I have coded a plugin to embed images into the email source (inspired 
by sendmail.inc :: rcmail_fix_emoticon_paths).

So far, so good. If you take the time to check the plugin, you'll see, 
that I have the image source in embed_images :: message_outgoing_body :: 
line 134 ($content).

Currently the image is save in Roundcube's temp_dir folder. I'm not 
happy with this step because basically this step is redundant.

I have analized Roundcube's mime class (./program/lib/Mail/mime.php). 
The method addHTMLImage allows to add content from $content (see third 
param $isfile). When trying this, the image is correctly created as a 
message part. The problem I have at this step is, that cid url 
replacement results in a mess.

I have played with:

#1 - 4th param content id
#2 - replace the image tag by an placeholder and create the tag again 
by <img src="cid: ... content_id ... @domain part of sender

... no sucess! Image urls results in a mess.

Either I'm too dumb or there is a bug anywhere.

Any advice is highly appreciated.


More information about the dev mailing list