Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error sending mail via MAPI on a win2k Server
Message
From
10/05/2002 10:07:30
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00654684
Message ID:
00655047
Views:
35
Michael,

The code sequence I'm using (that's working in my development win2k Pro PC) follows:
 objSession = CreateObject ("MAPI.Session")

 objSession.Logon (cSenderProfile, 0, 0, 1)

 objMessage         = objSession.Outbox.Messages.Add
 objMessage.Subject = cMessageSubject
 objMessage.Text    = cMessageText

 For nRecips = 1 To nRecipCount

     objRecip      = objMessage.Recipients.Add
     objRecip.Name = TabRecipInfo [nRecips]  &&  Array containing recipients
     objRecip.Type = 1                       &&  TO

     objRecip.Resolve

 EndFor

 objMessage.Update
 objMessage.Send
 objSession.Logoff
That code was based in: HOWTO: Use OLE Messaging to Send Mail in Visual FoxPro App - ID: Q146641, from the Microsoft Knowledge base (see below).
*==== Beginning of OLE Messaging Program.

   SESSION=CREATEOBJECT('mapi.session') && Create the MAPI object.
   SESSION.LOGON                        && Logon to mail; With exchange it
                                        && will prompt for a profile.

   NEW=SESSION.OUTBOX.MESSAGES.ADD             && Create a new message.
   NEW.SUBJECT = "Test Mail with OLE Messaging"   && Add a message subject.
   NEW.TEXT="Mail System Test"+CHR(13)+"using OLE!" && Actual message text.

   SENDTO=NEW.RECIPIENTS.ADD    && Add a recipient object
   SENDTO.NAME="myemailaddr"    && Email address to mail message to
   SENDTO.TYPE=1                && 1= "TO:"; 2="CC:"; 3="BCC:"
   SENDTO.RESOLVE               && Looks up address in addressbook.

   NEW.UPDATE       && Required to save changes to a message object.
   NEW.SEND(1,0,0)  && Parameter 1 = save copy in "Sent Mail" folder.
   SESSION.LOGOFF   && Release the MAPI object.

   *====End of OLE Messaging Program. 
I wonder what's different from my PC and the win2k Server?

Fernando
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform