NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd on June 25, 2011, 03:52:45 AM

Title: Send an Email with embedded image
Post by: terryd 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.

 

 

Title: Re: Send an Email with embedded image
Post by: Robert Iliuta 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
Title: Re: Send an Email with embedded image
Post by: terryd on June 26, 2011, 01:00:49 AM
Thanks Robert
testing today
Title: Re: Send an Email with embedded image
Post by: terryd 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]
Title: Re: Send an Email with embedded image
Post by: terryd on July 05, 2011, 01:49:48 AM
Sorry to repeat but can anyone help?
Title: Re: Send an Email with embedded image
Post by: Robert Iliuta on July 05, 2011, 08:32:24 AM
Hallo Terry,

it is very easy. See attached example.

Robert

[attachment deleted by admin]