Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook object only works when Debug invoked
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00841740
Message ID:
00841771
Views:
14
Do commands like save and display work?
....
.Recipients[2].Type = 2
.Save
.DISPLAY
...

>Yuri,
>
>No problem. The code is fairly straighforward as you will see.
>
>The email functionality is invoked via the Click() event method of a command button on a form. Here is the code for the button:
>
>If !Thisform.m_CreateOutLookSession()
> =Messagebox('Cannot invoke Outlook. Email not possible.','System Message',0+16)
> Return
>Endif
>
>lcText = "Greetings," + Chr(13)+Chr(13) + ;
>"And thank you for enrolling as a registered user." + ;
>"Your User ID and password for logging into the web site are listed below." + Chr(13) + Chr(13) +;
>"Access to this system by other than the account holder may violate state and " +;
>"federal confidentiality laws and make you vulnerable to civil litigation." + Chr(13)+Chr(13) + ;
>"Please secure your User ID and password to restrict their use to qualified personnel." + Chr(13)+Chr(13) + ;
>"Thank you," +Chr(13)+Chr(13) + ;
>"Web Administration"
>
>lcText = lcText + Chr(13)+Chr(13) + "User ID: " + websiteusers.userID
>lcText = lcText + Chr(13) + "Password " + websiteusers.password + Chr(13) + Chr(13)
>
>
>lcFrom = "Web Administration"
>lcSubject = 'Your Account Validation Information'
>lcCC = "testing@anyname.com"
>lcTo = Thisform.cEmailAddress
>loMsg = Thisform.oOutlook.CreateItem(0)
>
>If Vartype( loMsg ) = 'O'
> With loMsg
> .Subject = lcSubject
> .Body = lcText
> .Recipients.Add( lcTo )
> .Recipients[1].Type = 1
> .Recipients.Add( lcCC )
> .Recipients[2].Type = 2
> .Send()
> Endwith
>Endif
>
>Return
>
>********************************
>********************************
>
>The m_CreateOutLookSession() method called in line 1 looks like this:
>
>
>Local llRetVal
>
>If Type( 'Thisform.oOutlook' ) = 'O' And Not Isnull( Thisform.oOutlook )
> llRetVal = .T.
>Else
> With This
> .oOutlook = Createobject( 'Outlook.Application' )
> If Type( 'Thisform.oOutLook' ) = 'O' And Not Isnull( .oOutlook )
> .oNameSpace = .oOutlook.GetNameSpace( 'MAPI' )
> If Type( 'Thisform.oNameSpace' ) = 'O' And Not Isnull( .oNameSpace )
> llRetVal = .T.
> Endif
> Else
> llRetVal = .F.
> Endif
> Endwith
>Endif
>
>Return llRetVal
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform