none
Exchange server 2010 - Inline image transport agent RRS feed

  • Question

  • Hello,
    I have an Exchange server 2010 and I want to develop a transport agent to insert an image (inline) at the end of emails. Thanks to this topic I really advanced: http://blogs.technet.com/b/postwoman/archive/2010/09/14/step-by-step-how-to-create-a-routing-agent.aspx

    However, the problem persists. When the attachment (that is to say the image I want to insert in the email) is the MIME type, message contains the final image as an attachment and the final image is not inline.

    When the attachment is in MIME type here is the code that I apply:

    Attachment image = emailMessage.Attachments.Add("finalimage", "image/gif");
    
    Stream image_stream = image.GetContentWriteStream();
    image_stream.Write(image_binary, 0, image_binary.Length);
    image_stream.Flush();
    image_stream.Close();
    
    if (image.MimePart != null)
    {
        Header dis = image.MimePart.Headers.FindFirst(HeaderId.ContentDisposition);
        dis.Value = "inline";
    
        Header hContentId = Header.Create(HeaderId.ContentId);
        hContentId.Value = "<finalimage>";
        image.MimePart.Headers.AppendChild(hContentId);
    }

    I insert the HTML in email is : <img src=cid:finalimage>

    Do you have any solution?
    Thank you.

    Sunday, April 28, 2013 1:37 PM