c# - VSTO Outlook Embed Image MailItem -


i need embed image part of email, after user signature, not @ end of email, becasue if i'm sending reply of large email, embedded image it's going @ bottom of emails chain

  • how embed image part of email content (not link outside image)?
  • how add image after user signature?

i'm work vsto, vs2008 fwk3.5 , outlook 2007

here code:

public partial class thisaddin {     private void thisaddin_startup(object sender, system.eventargs e)     {         this.application.itemsend += new microsoft.office.interop.outlook.applicationevents_11_itemsendeventhandler(application_itemsend);     }      private void application_itemsend(object item, ref bool cancel)     {         if (item outlook.mailitem)         {             outlook.mailitem mailmessage = (outlook.mailitem)item;             //do add image after signature         }     } 

finally solved problem this:

private void sendformatted(outlook.mailitem mail) {     if (!string.isnullorempty(mail.htmlbody) && mail.htmlbody.tolower().contains("</body>"))     {         //get image + link         string imagepath = @"d:\\media\imagenes\100msdcf\dsc00632.jpg";         object linkaddress = "http://www.pentavida.cl";          //content-id         const string schemapr_attach_content_id = @"http://schemas.microsoft.com/mapi/proptag/0x3712001e";         string contentid = guid.newguid().tostring();          //attach image         mail.attachments.add(imagepath, outlook.olattachmenttype.olbyvalue, mail.body.length, type.missing);         mail.attachments[mail.attachments.count].propertyaccessor.setproperties(schemapr_attach_content_id, contentid);          //create , add banner         string banner = string.format(@"<br/><a href=""{0}"" ><img src=""cid:{1}"" ></a></body>", linkaddress, contentid);         mail.htmlbody = mail.htmlbody.replace("</body>", banner);          mail.save();     }  } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -