Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Erik Gomez
  Where is Erik Gomez?
 Victorias City, Negros Occidental
 Philippines
 Erik Gomez
 To: Dirk Steffens
  Where is Dirk Steffens?
 Cologne
 Germany
 Dirk Steffens
 Tags
Subject: RE: Outlook
Thread ID: 45668 Message ID: 50793 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Microsoft Office Automation
Date: Monday, September 06, 2004 10:17:15 AM         
   


> > >
> > > Hi All,
> > >
> > > Is it possible to automate an Outlook e-mail from within FoxPro AND fill it's contents?
> > >
> > > I have managed to use:
> > >
> > > url_used =mailto:abcd@yahoo.com.au?subject="This is the subect text"
> > > loRunIt = NEWOBJECT("_ShellExecute", HOME() + "ffc\_environ.vcx")
> > > loRunIt.ShellExecute(url_used)
> > >
> > > which I found somewhere on the net and which kicks off an Outlook e-mail with the address and subject automatically filled in.
> > >
> > > Unfortunately I've been unable to automate filling in the contents of the e-mail.
> > >
> > > For the moment I build the contents (which is just data contained in a table) using _cliptext and then when the e-mail automatically opens I paste in the contents.
> > >
> > > Can this last step also be automated?
> > >
> > > Thanks in advance.
> > >
> > > Russell.
> > hi Russell,
> >
> > try this,
> >
> > Local loOutlook,loSpace
> > 
> > loOutlook = Create('Outlook.Application')
> > loSpace = loOutlook.GetNameSpace('Mapi')
> > 
> > lnAttachments = 2
> > Dimension laAttachments[lnAttachments]
> > 
> > m.subject = 'Test Mail'
> > m.SendTo = 'myemail1@mydomain.com;myemail2@myotherdomains.com'
> > m.TextBody = 'Test Email'
> > m.CarbonCopy = 'myself@mydomain.com'
> > laAttachments(1) = 'c:\temp\sample1.txt'
> > laAttachments(2) = 'c:\temp\sample2.txt'
> > 
> > loNewItem = loOutLook.CreateItem(0)   && create new mail
> > With loNewItem
> > 	.subject = Alltrim(m.subject)   && subject
> > 	.To = m.SendTo   && main recipient
> > 	.body = m.TextBody   && text email body
> > 	.cc = m.CarbonCopy   && Carbon Copy recipient
> > 	For lnCnt = 1 To lnAttachments
> > 		lcAttachment = laAttachments(lnCnt)
> > 		.Attachments.Add(lcAttachment)   && insert attachments to email
> > 	Next
> > 	.Send   && send email
> > Endwith
> > 
> > loNewItem = ''
> > loSpace = ''
> > loOutlook = ''
> > 

> > note: this works only with MS Outlook and not with Outlook Express.
> >
> > search the forum for keyword "Outlook" for more info.
> >
> > hth,
> > Erik Gomez
> > www.foxite.com - The Home of The Visual FoxPro Experts
> > Long Live www.foxite.com
>
>
> Hi,
>
> do you also know how to set the mail format programmatically via mapi
> (richtext, plain text, HTML)?
>
> Thanks!
> Dirk
>
>
Hi,

use the .HTMLBody instead of the .Body property.

hth,
Erik Gomez
www.foxite.com - The Home of The Visual FoxPro Experts
Long Live www.foxite.com

ENTIRE THREAD

Outlook Posted by Russell Hill @ 6/28/2004 12:31:04 AM
RE: Outlook Posted by Eric den Doop @ 6/28/2004 7:34:19 AM
RE: Outlook Posted by Russell Hill @ 6/28/2004 9:00:46 AM
RE: Outlook Posted by Erik Gomez @ 6/28/2004 7:42:54 AM
RE: Outlook Posted by Russell Hill @ 6/28/2004 9:01:25 AM
RE: Outlook Posted by Dirk Steffens @ 9/5/2004 1:06:20 PM
RE: Outlook Posted by Erik Gomez @ 9/6/2004 10:17:15 AM
RE: Outlook Posted by Dirk Steffens @ 9/7/2004 11:29:02 AM