Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAPI Email
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
Miscellaneous
Thread ID:
00157994
Message ID:
00158120
Views:
16
Rick,

I'm not sure if this is some of the code you've seen. But it does work, and I occasionally get a random email from posting it (Mike Feltman did last week *g*) . The Logon name may be an issue. I kinda think it works once any user profile has been setup.
activate window "debug output"

* simple test email program using MAPI

oleMAPISession = createobject( "MSMAPI.MAPISession.1" )

* Signon to mail
with oleMAPISession
   .UserName = "Test"
   .Password = ""
   .Signon()
   * Check the SignOn status
   if ( .SessionID > 0 )
      oleMAPIMessages = createobject( "MSMAPI.MAPIMessages.1" )
      * tell the message the SessionID
      oleMAPIMessages.SessionID = .SessionID
      debugout "Successful mail log on"
   else
      debugout "Mail login failed"
      return
   endif
endwith

* Send an email

with oleMAPIMessages
   .Compose()

* Set the Recipient name and resolve
   .RecipDisplayName = "DavidFrankenbach@worldnet.att.net"
   .RecipType = 1
   .ResolveName()

   .MsgSubject = "This is the Subject"
   .MsgNoteText = "This is the email text"

   .Send( .f. )
endwith

* Read the InBox

with oleMAPIMessages
   .Fetch()
   for i = 0 to .MsgCount-1
      .MsgIndex = i
      debugout .MsgSubject
   endfor
endwith

* Signoff

oleMAPISession.Signoff()
>>Hmm... well, my mail server is down right now, but, it looks to me, like if you tell it to .send, it sends the message... Compose the message looks like it will sit in the outbox until you .send it.
>
>That doesn't work for me with Outlook. THe following will stuff the
>message into the inbox but not send it:
>
>
>  loMessages.Compose()
>
>   * Set the Recipient name and resolve
>   loMessages.RecipDisplayName = "rstrahl@west-wind.com"
>   loMessages.RecipType = 1
>   loMessages.ResolveName()
>
>   loMessages.MsgSubject = "Test Message"
>   loMessages.MsgNoteText = "Get a grip and go one with this bad message"
>
>   loMessages.SEND( .F. )
>
>
>
>I have a feeling this has something to do with the username and
>profile. I tried my username and password, but that didn't work
>right.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform