Q:

Is it possible to send inline image using email template in openerp?

I have to send an image using email template in OpenERP but I have to insert it just like we have a feature of insert image in gmail,yahoo and have here also in stackoverflow.com. 
I have to send image like this is because I want it should be displayed at the same time when mail is open, along with the text.
If I send it using attachments it coems in attachments which we can see just after download the image. I dont need this download option what I need is open image.
thanks in advance !

A:

There are 3 common ways to embed images within an email (in increasing complexity order): using public URLs, using Data URI to inline the image data in the src attribute, and using images attached to the email.
In all 3 cases you can use regular HTML techniques to include them in the HTML/Rich-Text body of the OpenERP email template: for example with an <img src="..."/> tag or the CSS background-image property.
Only the first 2 techniques will work out-of-the-box in OpenERP's email templates.
1. Using hosted images
The image URL can simply be a public URL on your website or any image hosting service on the internet:<img src="http://www.example.com/myimage.png">. This is very similar to what happens when you embed an image on stackoverflow, as the image is first uploaded to imgur.com automatically and the img src attributes refers to the URL of the uploaded image on imgur.com.
This works but nowadays most email clients (thunderbird, gmail, outlook, ...) will block remote images, as they are commonly abused to detect the fact that a given email was opened by its recipient (if the image is downloaded, it means the mail was opened). Typically the recipient will have to click a banner or warning in order to display these remote images.
This is the only technique that works out-of-the-box with OpenERP's email templates.
2. Using Data URI to inline the image data
The src attribute of an img tag can use the Data URI (RFC 2397) scheme to include the image binary source inline. The image tag would look like this:
<img src="data:mime-type;encoding,<encoded_image_data>"/>

For a PNG image, this could look like this 
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."/>

You can use this technique for OpenERP email templates, and it does not have the downside of being blocked by email clients. However you will need to manually convert your image to base64[A]. This will also substantially increase the size of your templates and your outgoing emails, and has several limitations (e.g. max 32KB if you want maximum compatibility).
[A]: Google "online base64 file encoder" if you want a simple way to do the conversion
3. Using attached images (not currently supported in OpenERP)
RFC 2111 specifies a way for message body parts to refer to other body parts using cid: URLs. For example the img src attribute within an email can refer to one of the attachments. Technically the img tag could look like this:
<img src="cid:some_unique_content_id/>

where some_unique_content_id is the Content-ID of the message part that contains the image. This is what it will look like in the final (raw) email:
------=_NextPart_WHATEVER_ID
Content-Type: image/jpeg;
    name="image.jpg"
Content-Transfer-Encoding: base64
Content-ID: <some_unique_content_id>
Content-Disposition: inline;
    filename="image.jpg"

/9j/4AAQ...continuation_of_the_base64_encoded_image

This technique also does not have the downside of being blocked by email clients, but it is more complex to implement because you need to specifically assign a Content-ID to each attachment, and the final email that is sent on the wire is bigger because it must contain the actual images.
This is not currently available in OpenERP, but it would not be very difficult to implement. One trivial way would be to automatically assign sequential Content-ID identifiers to all attachment (e.g. attachment_1, attachment_2) when the final mail is crafted by the email layer, and perhaps add an option in the email template Value Builder assistant to generate cid-based URLs for the attachments.

