Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

why others recipients are not able to see the image from my html? using win32 python

Hello guys i’m tryng to send an image in my html, when im testing sending it to myself is working fine But, if try to send to other recepients they don’t receive it how can i fix that:
any suggestion, thank you

my code is this:

   import win32com.client as win32

   olApp = win32.Dispatch('Outlook.Application')
   olNS = olApp.GetNameSpace('MAPI')


   mailItem = olApp.CreateItem(0)
   mailItem.Subject = 'test daily Email'
   mailItem.BodyFormat = 1
   mailItem.To = 'testing it with my myself@outlook.com'
   mailItem.Cc = 'others recepient@outlook.com'
   mailItem.htmlBody = '''\
        <html>
        <body>

        <h2>This is just a test</h2>

        <p>Using it for test before production</p>

        <img src="E:\\html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;">

        </body>
        </html>
        '''


   mailItem.Save()
   mailItem.Send()

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

They do see the image because they cannot possibly have access to your local file (E:\html5.gif).

You need to add the image as an attachment and set its content-id appropriately, then reference the image by that content id in your HTML.

See https://stackoverflow.com/a/28272165/332059

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading