1. Tadeo Rodriguez
  2. PowerBuilder
  3. Tuesday, 19 January 2021 19:53 PM UTC

I need to send emails from powerbuilder that contain an image embedded in message body , not as an attachment. Is this possible? Thank you for your attention and help.
Accepted Answer
Tadeo Rodriguez Accepted Answer Pending Moderation
  1. Friday, 21 May 2021 20:31 PM UTC
  2. PowerBuilder
  3. # Permalink

Hello All,


I found a solution...

//first, I get the image value from a table:

Selectblob column into :blob_variable from table where id=:xyz;

//Encode using Base64 and returns the encoded data

string ls_Base64Str

string ls_msgbodypicture 

CoderObject lnv_CoderObject
lnv_CoderObject = Create CoderObject
ls_Base64Str = lnv_CoderObject.Base64Encode(blob_variable)

// set string variable 

ls_msgbodypicture = '<img src="data:image/png;base64,'+ls_Base64Str+'" alt="img" />'

//set the messsage

ls_msgbodyemail = '<p>This is a test </p>'+&

                             '<p>'+ls_msgbodypicture +'</p>'


// "HTML"
lOle_Outlook_Item.BodyFormat = 2
lOle_Outlook_Item.HTMLBody = ls_msgbodyemail 

lb_Return = lOle_Outlook_Item.Send()


I'm using the OLEObject Mail sending...



Thanks everyone for your help.





  1. Miguel Leeuwe
  2. Sunday, 23 May 2021 05:50 AM UTC
Thanks for sharing!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 19 January 2021 22:25 PM UTC
  2. PowerBuilder
  3. # 1

Hi Tadeo,

There's 3 ways of adding an image to an email (that I'm aware of).

1. have a link to the image on some file/content server

2. embed as binary values, but most email clients will reject that nowadays

3. in the moment of sending have a temporary file somewhere on disk, add the file to the html using the "cid" tag and attach this file as a "hidden" attachment. Since you say you don't want to attach any files, I won't expand on how to do that. (but it IS the method that gives us most success).


There are no comments made yet.
Andrew Barnes Accepted Answer Pending Moderation
  1. Tuesday, 19 January 2021 21:00 PM UTC
  2. PowerBuilder
  3. # 2

And if your database is SQL Server, you can use sp_send_dbmail to send an email.  Either way, for an embedded image, Chris's of sending in HTML format is the way to go.

There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 19 January 2021 20:24 PM UTC
  2. PowerBuilder
  3. # 3

Hi Tadeo;

  I would suggest that you send the email in HTML format for that requirement.




Regards ... Chris


There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.