Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Paul Michael
  Where is Paul Michael?
 Shelton
 Connecticut - United States
 Paul Michael
 Tags
Subject: VFP Email - please assist
Thread ID: 22108 Message ID: 22108 # Views: 55 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Wednesday, April 09, 2003 3:43:30 PM         
   


Good morning Foxpro Guru's :<)

TARGET:
To created a small email prg (vfp6.0) that selects all records that contain an 'N' in the "signed" field, along with the resuired fileds to show in the email body and send them to the MS outlook 2000 outbox.

Thank you,
PM

ERROR:

MS Outlook: "An error occured while attempting to open the Windows Address Book, MAPI 1.0 [00000220]"

CLICK OK:

VFP Program Error: "OLE IDispatch exception cone 0 from MAPIsession Login has failed"


Note: I'm not utlizing the address book in MS Outlook 2000. I have a profile called 'testmail' {Use this profile selected in Outlook).

PURPOSE:
The fields I need to show in the Form/Grid hence the data from these field appearing adjcent of the nanes are in paretisses ""
May table is called Mails.dbf

"Tracking Number" = Trackno
"Carrier Name" = Carr
"Service Name" = Service
"Date Received" = Rdate
"Time Received" = Rtime
"Rcv Clerk ID" = Clerkid
"Sender Name" = Sndname
"Sender Address" = Sndaddr
"Sender City" = Sndcity
"Sender State" = Sndstat
"Sender Zip" = Sndzip
"Phone Number" = Recvrphone

CODE:

Create Cursor testmail (signed c(1), packnumber i, Rdate d)
For ix=1 To 100
Insert Into testmail Values ;
(Chr(Asc('a')-1+Ceiling(Rand()*26)), ix, Date()-ix)
Endfor
Browse For signed = 'n' && Would email these

Local lcTarget, lcCurdir, oForm
lcCurdir = Sys(5)+Curdir()
lcTarget = 'pm007_@email.com' && Sending all to myself for testing
Select testmail

oform = Createobject("form")
oform.AddObject("oSession","olecontrol","MSMAPI.mapiSession")
oform.AddObject("oMessage","olecontrol","MSMAPI.mapiMessages")
oform.oSession.signon
With oform.oMessage
.sessionid = oform.oSession.sessionid
Scan For siged = 'n' && Would email these
.compose
.msgsubject = "Notification"
.msgnotetext = ;
"Package Number: "+ Transform(packnumber)+Chr(13)+Chr(10)+;
"Package date :" + Transform(Rdate,'@YL')+Chr(13)+Chr(10)+;
"Best Regards"
.RecipAddress = lcTarget
.RecipType = 1
.ResolveName()
.Send(.F.)
Endscan
Endwith
Set Default To (lcCurdir)



COMPLETE THREAD