Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS OUTLOOK Vs. Outlook Express
Message
From
24/10/2009 17:05:51
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01430710
Message ID:
01431254
Views:
38
i lost the actual initial thread that started this topic - so i'm going to jump in her midway.

i am having trouble getting mapi to work on several of our computers which are using MAPI and which use Office Outlook. Right now it works seemlessly on computers using Outlook Express - i read that only FULL EXTENDED MAPI works with Office Outlook and Exchange. That would seem to point to your #9524 download. I pretty much rely on the expertise of this unversalthread group who have thankfully kept me afloat in asea of novel programming procedures. So i have looked at the down load and it seems pretty daunting to a novice - but perhaps i am further on than i think.

The code i have been using is below which i pinched off of a previous posting and works wonderfully (with express).

What i would like to know is how to upgrade to this full method usng your download. Could it be as simple as placing the downloaded files into my working foxpro directory and using the same code as below or is that wishful thinking. I hesitate to do this for fear of rendering previous setup non-functioning.

Sorry for dragging this thread to the bottom floor.

k

SENDING AN ATTACHMENT IN EMAIL


Dimension aryAttach(1) && Add as many elements (attachments) as you like
Local lcFrom, lcTo, lcSubject, lcBody, lnCount, lcCC, lcBCC, lcUserName, lcPassword, llEmailStatus, lcErrorHandlerWas
***** Replace the following with real values to run this example********
aryAttach(1) = "C:\same.txt" && File to attach, add more if needed
lcFrom = "me@somewhere.net"
lcTo = "you@somewhere.net; someonelse@somewhere.com"
lcCC = "mv@met.com"
lcBCC = "mv2@met.com"
lcUserName = "" && Only if required by default smtp server
lcPassword = "" && Only if required by default smtp server
*************************************************************
lcSubject = "VFP Email Via MAPI"
lcBody = "MAPI seems to work pretty good."
lcErrorHandlerWas = On("ERROR")
Wait Window " One Moment... Email is being generated and sent " Nowait

llEmailStatus = SendViaMAPI(lcFrom, lcTo, lcSubject, lcBody, @aryAttach, lcCC, lcBCC, lcUserName, lcPassword)
On Error &lcErrorHandlerWas
Wait Clear
If llEmailStatus
Messagebox("Your message to " + lcTo + " has been sent.",64,"EMAIL SENT SUCCESSFULLY VIA MAPI")
Else
Messagebox("Your message to " + lcTo + " was not sent.",64,"EMAIL PROBLEM WITH MAPI")
Endif

**********************************************************************
Function SendViaMAPI(tcFrom, tcTo, tcSubject, tcBody, taFiles, tcCC, tcBCC, tcUserName, tcPassword)
**********************************************************************
#Define Primary 1
#Define CARBON_COPY 2
#Define BLIND_CARBON_COPY 3
Local loSession, loMessages
On Error Return(.F.)
loSession = Createobject("MSMAPI.MAPISession")
If Type('tcUserName') = 'C'
loSession.UserName = tcUserName
Endif
If Type('tcPassword') = 'C'
loSession.Password = tcPassword
Endif
loSession.Signon()
If (loSession.SessionID > 0)
loMessages = Createobject( "MSMAPI.MAPIMessages" )
loMessages.SessionID = loSession.SessionID
Endif
With loMessages
.Compose()
.RecipDisplayName = tcTo
.RecipType = Primary
*.ResolveName()

If Type("tcCC") = "C" And !Empty(tcCC)
.RecipIndex = .RecipCount
.RecipDisplayName = tcCC
.RecipType = CARBON_COPY
.ResolveName()
Endif
If Type("tcBCC") = "C" And !Empty(tcBCC)
.RecipIndex = .RecipCount
.RecipDisplayName = tcBCC
.RecipType = BLIND_CARBON_COPY
.ResolveName()
Endif
If Type('taFiles',1) = "A"
For lnCountAttachments = 1 To Alen(taFiles)
.AttachmentIndex = .AttachmentCount
.AttachmentPathName = taFiles(lnCountAttachments)
Endfor
Endif
.MsgSubject = tcSubject
.MsgNoteText = tcBody
.Send(.T.)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform