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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html before text 1

Status
Not open for further replies.

rouse01

IS-IT--Management
Sep 10, 2001
143
US
I need to email in html format to a client list. When I test this code, the client email reader gets a text rendering first & the html package is at the bottom. The html works fine, but the text looks pitiful. I'd rather the html "icon link" to show up at the top if possible. I'm using VFP 6 & outlook 2000. Any Ideas or recomendations?

This is a snippet:

scan
store a.email to m.recpt
do ol_mail
endscan

on error

***************
procedure ol_mail

Ol_Object = CreateObject("Outlook.Application")
oEmailItem = Ol_Object.CreateItem(MAILITEM)

WITH oEmailItem
.Recipients.Add(m.recpt) && uses the Recipients collection
.Subject = "This is a Very Important Test!"
.Importance = IMPORTANCENORMAL
.HTMLBody = m.body
.Send
ENDWITH

Thanks - Keith
 
Keith,

At first glance your code looks OK. However, it is not clear what you are storing in m.body. If you could show an example of what's in that variable, it would be easier to see what's going on.

Mike


Mike Lewis
Edinburgh, Scotland
 
Dave,

don't you somewhere, either upon creating the letter or sending it, have to specify it is to be sent as HTML rather than plain text?

In fact, you don't. The fact that the message is stored in .HTMLBody rather than .Body is all you need to do.

Mike


Mike Lewis
Edinburgh, Scotland
 
Thanks Mike & Dave. I'm not sure why this happened, but when I tested this using my own email address with ol client, the first time it came in with the text followed by a html icon at the bottom. When I clicked the icon, the page appeared as I expected. After making changes & resending a few times, every time thereafter the package opened as html. So, I'll test it on a few other clients before I go live.
This is my first attempt at this. I stow the newsletter in a memo field in a fp table. The newsletter has some css styles. I backed off & tried a simple:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Test Email</title>
</head>
<body>
<h1>Hello, This is a test</h1>
</body>
</html>
...in the body & that worked ok, so probably I had some syntax problem in the first attempt.
Dave, I thought I needed to use something like .BodyFormat= 2, but apparently that's for VB or something else.
Thanks again for the replies - Keith
 
Any comment on this appreciated...
When I examine delivered emails, my foxpro generated email to myself has the following in the header:

MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary=&quot;----=_NextPart_000_001D_01C3D566.809477E0&quot;

I think this is why my email client shows the entire email as text before the html link. However, a newsletter I subscribe to (which opens flawlessly in full html) has this in it's headers:

MIME-Version: 1.0
Content-Type: text/html;
charset=&quot;iso-8859-1&quot;
Content-Transfer-Encoding: 7bit

I expected the '.HTMLBody = m.body' in my .prg above would send the proper headers, but it apparently does not. Am I right that the header in my own email is the culprit, and if so how do I fix this?

Thanks in advance,
Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top