Results 1 to 8 of 8

Thread: CDO.Message not working in 64bit

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    8

    Question CDO.Message not working in 64bit

    Hello everybody!

    I'm facing a problem related with CDO.Message in a VB6 aplication.

    The code below works fine but when executing in a 64-bit server it returns Automation Error: %1 is not a valid Win32 application.

    In have referenced in my aplication "Microsoft CDO for windows 2000 Library" (cdosys.dll)

    Code:
    Public Function SendMail(sTo As String, sSubject As String, sFrom As String, _
        sBody As String, sSmtpServer As String, iSmtpPort As Integer, _
        sSmtpUser As String, sSmtpPword As String, _
        sFilePath As String, bSmtpSSL As Boolean) As String
          
        On Error GoTo SendMail_Error:
        Dim lobj_cdomsg      As CDO.Message
        Set lobj_cdomsg = New CDO.Message
        lobj_cdomsg.Configuration.Fields(cdoSMTPServer) = sSmtpServer
        lobj_cdomsg.Configuration.Fields(cdoSMTPServerPort) = iSmtpPort
        lobj_cdomsg.Configuration.Fields(cdoSMTPUseSSL) = bSmtpSSL
        lobj_cdomsg.Configuration.Fields(cdoSMTPAuthenticate) = cdoBasic
        lobj_cdomsg.Configuration.Fields(cdoSendUserName) = sSmtpUser
        lobj_cdomsg.Configuration.Fields(cdoSendPassword) = sSmtpPword
        lobj_cdomsg.Configuration.Fields(cdoSMTPConnectionTimeout) = 30
        lobj_cdomsg.Configuration.Fields(cdoSendUsingMethod) = cdoSendUsingPort
        lobj_cdomsg.Configuration.Fields.Update
        lobj_cdomsg.To = sTo
        lobj_cdomsg.From = sFrom
        lobj_cdomsg.Subject = sSubject
        lobj_cdomsg.TextBody = sBody
        If Trim$(sFilePath) <> vbNullString Then
            lobj_cdomsg.AddAttachment (sFilePath)
        End If
        lobj_cdomsg.Send
        Set lobj_cdomsg = Nothing
        SendMail = "ok"
        Exit Function
              
    SendMail_Error:
        SendMail = Err.Description
    End Function
    I had search the web and unable to find a definitive solution for this error message.
    I would appreciate any help. Thanks!

    Greetings to all!

    HendelCwb

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: CDO.Message not working in 64bit

    In have referenced in my aplication "Microsoft CDO for windows 2000 Library" (cdosys.dll)
    try removing the reference and using late binding, i do not know if this will work, but something to try
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    8

    Re: CDO.Message not working in 64bit

    Hi west, I'm glad by your suggestion but late binding does not solve the problem.

    Does anyone know if CDO library is compatible with a server running 2008 R264 bit?

    Besides use CDO.Message or connect with a Outlook object is there any other way to send a e-mail through VB6?


    Thanks!
    Last edited by Hendelcwb; Feb 5th, 2013 at 04:57 PM.

  4. #4
    gibra
    Guest

    Re: CDO.Message not working in 64bit

    I suggest to use MAPI library (MAPI32.DLL), no problems on Windows7 64-bit.

    http://www.thescarms.com/VBasic/MapiEmail.aspx

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    8

    Re: CDO.Message not working in 64bit

    Gibra, thanks by the information but for any reason I don't have the MAPI installed in my computer (windows 7 starter SP1).

    But before I try to install MAPI I discovered that in Windows 2008 R2 server doesn't exist the file CDOSYS.DLL.

    And I found this HotFix information from microsoft support: http://support.microsoft.com/kb/982720/en

    I hope this solves my problem.

    Thanks for help!

  6. #6
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: CDO.Message not working in 64bit

    Quote Originally Posted by Hendelcwb View Post
    Does anyone know if CDO library is compatible with a server running 2008 R264 bit?
    Just tried it. Worked fine, nothing to install.

    Quote Originally Posted by Hendelcwb View Post
    Gibra, thanks by the information but for any reason I don't have the MAPI installed in my computer (windows 7 starter SP1).
    The Simple MAPI used by the mail components that come with VB6 has not been supported for a long time. As far as I know you need to add other software that supplies a Simple MAPI wrapper. Some versions of Outlook may do this, 3rd party email clients, etc.



    Quote Originally Posted by Hendelcwb View Post
    I discovered that in Windows 2008 R2 server doesn't exist the file CDOSYS.DLL.

    And I found this HotFix information from microsoft support: http://support.microsoft.com/kb/982720/en
    That MS KB article is about CDOEX, not CDOSYS. CDOEX is a library that can replace CDOSYS when you install Exchange Server (or Outlook in "corporate LAN" mode). When you install CDOEX it takes over many of the classes supported by CDOSYS, redirecting their class registration to point into CDOEX.DLL instead of CDOSYS.DLL.


    It is far more likely something is "broken" on your server. A common problem stems from faulty software that has created a file "Programs" in the root of your boot drive. This usually happens because of a bad installer that didn't quote a path with "Program Files" in it properly and the space caused a "Programs" file to be created.

    {"No no" setup, I'm looking at you!}

    Another source of this error is a 64-bit process trying to load a 32-bit DLL, usually as part of an IIS application. That seems less likely here.

    Another source is a 64-bit server OS where WOW64 is optional and this subsystem has not been installed.
    Last edited by dilettante; Feb 6th, 2013 at 08:57 AM.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    8

    Re: CDO.Message not working in 64bit

    Dilettante, thanks for all time and information you provide to help!

    Despite not using the CDOEX I'm thinking to ask server administrator if posible to run this HotFix because the microsoft article says it installs the CDOSYS.DLL (see it in the File Information section). But also I'll argue with administrator about the "SysWOW64". I know nothing about it but he must know...


    Thanks again!

  8. #8
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: CDO.Message not working in 64bit

    As far as I know, installing CDOEX takes over the COM classes but it still makes non-COM calls into the CDOSYS.DLL to actually accomplish some of those things, so it probably makes sense that the KB fix installs a new CDOSYS.

    CDOSYS.DLL should not be missing though. It installs as part of Windows. There should be both 64-bit and 32-bit versions on that server if the WOW64 subsystem is installed.

    If you can run any VB6 programs at all on that server then you do not have a SysWOW64 issue. Can't hurt to see if there might be a C:\Program (no extension) file on the machine though either.
    Last edited by dilettante; Feb 6th, 2013 at 08:56 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width