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

MAPI works in interpreted code but not in a compiled DLL 1

Status
Not open for further replies.

Brawn

Programmer
Jul 5, 2001
73
CA

Hi,

I need some help.

I'm building a WebClass application and I'm using MAPI to mail information. It works as interpreted code (while I can debug) but not as a compiled DLL.

any thoughts. Brawn

"My mind is my Shrine,
and my body the Temple around it."
 
I tried writing messages to a text file and now I know that when I try to sign on with the MapiSession object, the program hangs.
This is what I have:
Code:
        Dim fso As New Scripting.FileSystemObject
        Dim File As File
        Dim Stream As Scripting.TextStream
        
    Dim mailSession As Object
    Dim mail As Object
    
        Set File = fso.GetFile("D:\Shopping Cart Project\Deployment\debuglog.txt")
        Set Stream = File.OpenAsTextStream(ForAppending)
        Stream.WriteLine " start write" & vbCrLf
    Set mailSession = CreateObject("MSMAPI.MAPISession")
    Set mail = CreateObject("MSMAPI.MAPIMessages")
    On Error GoTo ErrorHandler
    mailSession.UserName = "user"
    mailSession.Password = "pass"
    mailSession.NewSession = True       'force a new session
    mailSession.DownLoadMail = False    ' don't get new mail
    mailSession.LogonUI = False         'suppress dialog box

            Stream.WriteLine "about to start session" & vbCrLf
mailSession.SignOn
Code:
            Stream.WriteLine "started session" & vbCrLf
        mail.sessionid = mailSession.sessionid
        mail.Compose                    'clear buffers
        mail.RecipAddress = "user@work.com"
        mail.MsgSubject = "Order Information"
        mail.MsgNoteText = order
            Stream.WriteLine "about to send message" & vbCrLf
        mail.Send False
            Stream.WriteLine "msg sent" & vbCrLf
    mailSession.SignOff
            Stream.WriteLine "end session ----- mail worked" & vbCrLf
            Stream.Close
    Exit Sub
ErrorHandler:
    Err.Raise Err.Number, Err.source, Err.Description
    Stream.Close


Again, it works as interpreted code but not after compiling to a ActiveX DLL :cool:
Brawn

"My mind is my Shrine,
and my body the Temple around it."
 
Is this mapi a reference or a componet? In which ase you would need to include those too.

I can't say that this is my strongest vb area. Brad,
Free mp3 player,games and more.
 
Its a Component
Microsoft MAPI Controls 6.0
It is checked in the Components window.

I don't think I hafta do anything else to use the component.
I tried JMail to, and its the same thing,

Works in interpreted code, but not the compiled dll.

Arrrrrggggggg!

Do these components not work in WebClasses, IIS applications or In-Process Components?

You would think it would crash or something. It tries to sign on to the server, but it just hangs. I have to Reboot everytime I try it.

HELP!
Brawn

"My mind is my Shrine,
and my body the Temple around it."
 
. . . . :cool: Brawn

"My mind is my Shrine,
and my body the Temple around it."
 
Yessssssssssss. Yes. yes. yes. :)

Snaggs you're awesome,
Thank You

This was day number 4 on this problem.

It was Definitly a late binding issue.

That article definitely told me what I needed to know.

Thanks again,

Brawn

Article:
Brawn

"My mind is my Shrine,
and my body the Temple around it."
 
Brawn,

Did you get it working? Be sure you read the section in the article that has the IMPORTANT heading. Also the last 2 paragraphs are important if your control raises events.

Snaggs
tribesaddict@swbell.net
Life can only be understood backwards; but it must be lived forwards.
 
Yup, it's working great Snaggs.

Thanks agian, I've bookmarked that page for further reference.

This is my first VB interet program. Actually, this is only my 4th VB program altogether.

I've learned so much, but the more I learn, the more I feel like what I know is so little.
(does that make sense)

It's people like you in forums like this that make me feel that I'm not alone the learning struggle.

:)

Brawn

"My mind is my Shrine,
and my body the Temple around it."
 
Cool! I used that control and just happend to run across it several years ago. Then about a year ago I used the control in a project and had the need to put the functionality in a DLL, much like what you needed. It worked great for me.

Half the fun of programming is learning... but no one's figured out what the other half is for.

Snaggs
tribesaddict@swbell.net
Life can only be understood backwards; but it must be lived forwards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top