0

I'm looking for a way to automatically compress pictures in a message in Outlook when it is sent. These pictures can be attachments or are in the html message body.

The way i found is for attachement by passing in "File" then an option like Resize the pictures (don't know the name of option in english) => I would like this option is by default enabled to avoid to forget to enable this

On the other way, if i have some picture inside the body message, i can use the button "compress pictures" for all the pictures in the message but once again i would like it was by default.

Have you got any idea to perform this with the outlook options or by VBA? Thank you

Ksartor
  • 75
  • 8

1 Answers1

0

You can find images used in the message body attached to Outlook items. In the HTMLBody property value you can meet the following entries for such images:

"<IMG src =""cid:Filename"">"

On the attachment you can find the "cid:" value set up using the following property:

Const PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001F"

The PropertyAccessor.GetProperty method can be use to retrieve the property value (on the attachment).

Finally, after detecting embedded images the Attachment.SaveAsFile method which saves the attachment to the specified path can be used. On the disk you can make all the required modifications and then re-attach the file anew (after deleting the source).

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Have you got an example? WHat about the picture in attachement? – Ksartor Mar 12 '23 at 04:44
  • You may try searching over the internet for the sample code, for example, take a look at [Distinguish visible and invisible attachments with Outlook VBA](https://stackoverflow.com/questions/12310925/distinguish-visible-and-invisible-attachments-with-outlook-vba) – Eugene Astafiev Mar 12 '23 at 15:38