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

Vfp Email problem

Status
Not open for further replies.

PBREP

MIS
Mar 14, 2003
75
US
Good afternoon Foxpro Guru's :<)

TARGET:
To created a small email prg (vfp6.0) that selects all records that contain an 'N' in the &quot;signed&quot; 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: &quot;An error occured while attempting to open the Windows Address Book, MAPI 1.0 [00000220]&quot;

CLICK OK:

VFP Program Error: &quot;OLE IDispatch exception cone 0 from MAPIsession Login has failed&quot;


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 &quot;&quot;
May table is called Mails.dbf

&quot;Tracking Number&quot; = Trackno
&quot;Carrier Name&quot; = Carr
&quot;Service Name&quot; = Service
&quot;Date Received&quot; = Rdate
&quot;Time Received&quot; = Rtime
&quot;Rcv Clerk ID&quot; = Clerkid
&quot;Sender Name&quot; = Sndname
&quot;Sender Address&quot; = Sndaddr
&quot;Sender City&quot; = Sndcity
&quot;Sender State&quot; = Sndstat
&quot;Sender Zip&quot; = Sndzip
&quot;Phone Number&quot; = 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 = 'om007_@email.com' && Sending all to myself Select testmail

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

 
Why don't you use Outlook automation instead?
Take a look at faq184-766 Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Or faq184-1768 Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top