Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email with picture in body 1

Status
Not open for further replies.

fluppe689

Programmer
Jul 11, 2008
75
BE
Hi Experts,

A have a program to make an email, no big deal.
Only a want to add a picture below the text.
is this possible.

My code is like this
oCRApp = CREATEOBJECT("crystalruntime.application")
oRep = oCRApp.OpenReport("s:\merlijn\exbestel.rpt")

oExport = oRep.Exportoptions()
oExport.Destinationtype = 1
oExport.FormatType = 31
oExport.Diskfilename = "&xxattach"
oRep.EXPORT(.F.)

m.xxsubject ="ORDERBEVESTIGING"
m.xxbody ="Geachte Klant,"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+ "Gelieve de in bijlage bijgevoegde bestelling te controleren "+CHR(13)+CHR(10)+;
"Indien U vragen hieromtrend staat het verkoopsteam altijd ter Uwer beschikking."+CHR(13)+CHR(10)+;
"Gelieve bij afhaling uw bestelnummer(staat op de pdf) te vermelden."+CHR(13)+CHR(10)+;
+CHR(13)+CHR(10) +"Met vriendelijke groeten,"+CHR(13)+CHR(10)+"Het Verkoopsteam"
o=CREATEOBJECT("outlook.application")
TRY
oitem = o.createitem(0)
CATCH TO loException WHEN INLIST(loException.ERRORNO,1427,1429)
MESSAGEBOX("You didn't allow this program to use outlook or outlook isn't open, please try again",0,"this program")
ENDTRY
o=CREATEOBJECT("outlook.application")
oitem = o.createitem(0)
oitem.subject = m.xxsubject
oitem.TO = m.xxto
oitem.cc = '
oitem.bcc = '
oitem.Attachments.ADD("&xxattach")
oitem.body = m.xxbody
oitem.display()
 
I think your body would have to be an HTML page, rather than a text one for this to work.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
hello Griff,

I have no experience with html page in a body
Can You give me some more info please

wfg,

Filip

 
you can set the mail items format via oitem.bodyformat. Intellisense says: 0 - undefined, 1 - text, 2 - html, 3 - rtf

Use 2 (HTML) and then set oitem.HTMLBody and you can send html formatted mails including any layout and embedded images.

You can use an img tag with a src as a URL of some picture, or you add a picture as an mail attachment and then refer to it as "cid:filaneme.jpg" as it's URL. Such urls are mime standard for referring to content ids.

You get the picture?

Bye, Olaf.
 
My solution would to create a MHTML document rather than an HTML document. Chances are if you create an HTML document and you put a link to an image, that the image will most likely not follow the e-mail. But with an MHTML document the text and the image (in a binary format) make a single document. So the image will follow along with the e-mail.

Here is an example using vfpwinsock and CDO. But you can adapt it to Oulook also.
Code:
 v_mhtml = Sys(2015)+".mht"
 oCdo = Createobject("CDO.Message")
 oCdo.CreateMHTMLBody("[URL unfurl="true"]http://www.atoutfox.org")[/URL]
 oStream = oCdo.getstream()
 =oStream.SaveToFile(v_mhtml,1)
 oStream=null
 Ocdo=Null
 

 set proc to vfpWinsock additive
   o=CREATEOBJECT("VFP_Winsock_Send_Mail")
   o.TO        = "destinataire@email.com"
   o.Subject   = "Expédition MHTL généré avec CDO"
   o.data_mhtml= v_mhtml
   =o.send()
   o=Null
 release procedure vfpWinsock
 
erase (v_mhtml)


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top