NetTalk Central

Author Topic: Send an Email with embedded image  (Read 4875 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Send an Email with embedded image
« on: June 25, 2011, 03:52:45 AM »
How do I embed an image called e.g. file.jpg in an email?
I first tried the EmbedImages method

    ThisSendEmail.EmbedList = ThisSendEmail.EmbedImages('C:\embed.htm',1,'C:\')

Where embed.htm looks like this:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<IMG SRC="C:\file.jpg">
</BODY>
</HTML>

I get the compile error No matching prototype available on that line

Since I only need to embed 1 image in the email I then looked at the EmbedList property
The example says:
Example:
In your HTML code you could embed a gif file using the following syntax:
<img src="cid:MyPic.gif">   ! Note the use of the cid:
You would then need to set self.EmbedList = 'c:\SomeDir\MyPic.gif'


So I try
Example:
ThisSendEmail.embedList = 'C:\file.jpg'
what I don't understand is the <img src="cid:MyPic.gif">   ! Note the use of the cid:
section since the setting: self.EmbedList = 'c:\SomeDir\MyPic.gif'
seems to have no relation to that line.

Any help appreciated.

 

 

Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: Send an Email with embedded image
« Reply #1 on: June 25, 2011, 10:10:34 PM »
Hallo Terry,


<So I try
<Example:
<ThisSendEmail.embedList = 'C:\file.jpg'
<what I don't understand is the <img src="cid:MyPic.gif">   ! Note the use of the cid:
<section since the setting: self.EmbedList = 'c:\SomeDir\MyPic.gif'
<seems to have no relation to that line.
well it has a big relation :-)

Try this:

ThisSendEmail.EmbedList = LONGPATH()&'\web\EmailPhotos\image001.png'

then in html code you will put:
<img width=48 height=39 src="cid:image001.png" align=left />

Note the html text need to be hand coded in embed where you set the loc:HTMLtext or you will need to load in a string and then replace the name of the photo with cid.

loc:HTMLtext = clip('<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=windows-1250">  '&|
'<HTML>'&|
'<HEAD></HEAD>'&|
'<BODY><img width=48 height=39 src="cid:image001.png" align=left /></BODY>'&|
'</HTML>'

now you are ready. Just test.

good luck,
Robert

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Send an Email with embedded image
« Reply #2 on: June 26, 2011, 01:00:49 AM »
Thanks Robert
testing today
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Send an Email with embedded image
« Reply #3 on: July 01, 2011, 09:18:26 AM »
Robert
Please see attached image
left hand side is the received email, right hand side is the embedded code in the email send procedure.
Looks almost right, The image exists in the c:\drive but
What's missing?


[attachment deleted by admin]
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Send an Email with embedded image
« Reply #4 on: July 05, 2011, 01:49:48 AM »
Sorry to repeat but can anyone help?
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: Send an Email with embedded image
« Reply #5 on: July 05, 2011, 08:32:24 AM »
Hallo Terry,

it is very easy. See attached example.

Robert

[attachment deleted by admin]