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

Outlook problems

Status
Not open for further replies.

aharrisreid

Programmer
Nov 17, 2000
312
GB

I am using OLE automation with VFP and Outlook to create emails from VFP data using something like the code below...

* -----------------------------
lcHTMLString = my message formatted as html

lcHTMLString = [<html><body>]+lcHTMLString+[</body>] && add HTML body code


oOutlook = CREATOBJECT('Outlook.application')
oItem = oOutlook.createitem(0) && create new mail message

WITH oItem
.recipients.add(emailaddress)
.subject = MySubject&quot;
.HTMLBody = lcHTMLString
.save()
.send()
ENDWITH
* -----------------------------

If I select to send the emails immediately they are generated, the received emails look fine, but if I try to view the sent version (ie. the message stored in the 'out-tray'), the body of the email is blank! Is this because I have used the .HTMLBody property instead of .body?

I originally did use oItem.body to store the message, and that worked fine, until I needed to line-up some data halfway through the message and use a non-proportional font. Placing <FONT FACE=&quot;Courier New&quot;> and </FONT> in the text string did not work - it output literally, that's why I resorted to an HTML string solution.

a) If I use the .HTMLBody property, how can I view the emails before transmission?
b) If I use the .body property, how can I embed HTML formatting tags?


Any help would be appreciated.

Alan Harris-Reid

 
Alan

If I select to send the emails immediately they are generated, the received emails look fine, but if I try to view the sent version (ie. the message stored in the 'out-tray'), the body of the email is blank! Is this because I have used the .HTMLBody property instead of .body?

I get the same result as you on this, so I assume that the message is stored in the property.

But I assume that you are doing this knowing that all your receptients can receive in HTML. Because it looking bad when I receive an HTML formatted message and my e-mail is not set for it.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Alan,

Just a suggestion: Have you tried to use E-Mail OLE controls? Those stored in MSMAPI32.OCX? I use them instead of OLE automation technique.

Regards,

Ilya
 
Ilya, thanks for the reply.

>>Have you tried to use E-Mail OLE controls? Those stored in MSMAPI32.OCX? I use them instead of OLE automation technique.<<

Never used them before. Can you give me a starting point, a reference or a code snippet?

Many thanks,
Alan
 
IRABYY

Illya

I am not sure Mapi session support HTML body.

aharrisreid

Take a look at Faq184-1769
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
mgagnon (Programmer):

Illya (My name is ILYA, not ILLYA. ... None taken.[smile])

I am not sure Mapi session support HTML body.

Mike,

MAPI employs whatever E-Mail S/W is installed on the user's machine. If it's Outlook - it'll be brought up. If that version of Outlook supports HTML body - it should work. Haven't had the luck with employing AOL, though. Have you ever tried it?

Alan,

Take a look at the article Mike references to in his reply. It gives a good headstart.

Regards,

Ilya
 
Irabyy,

Have you ever done HTML with the MAPI controls? Have tried, but with no success. Maybe I am doing something wrong?

Thanks,
rabbit75
 
Ilya

MAPI employs whatever E-Mail S/W is installed on the user's machine. If it's Outlook - it'll be brought up. If that version of Outlook supports HTML body - it should work. Haven't had the luck with employing AOL, though. Have you ever tried it?

Like I said, when I wrote that FAQ I remembered notiicing that it did not support HTML format.
I did test the FAQ184-1768 CDO.dll and that supports HTML.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
rabbit75 (Programmer): &quot;Have you ever done HTML with the MAPI controls?&quot;

No, I haven't. I did it in VFP 3.0 and VFP 7.0 for the regular desktop applications, and it was separate feature/function off the bar menu.

Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top