没看到 你的代码, 所以不要 判断. 只有把我的 程序给你参考一下:
========================================================
通过  MAPI  ,调用  OUTLOOK  发信的例子: 
================================================================== 
VERSION  5.00 
Object  =  "{20C62CAE-15DA-101B-B9A8-444553540000}#1.1#0";  "MSMAPI32.OCX" 
Begin  VB.Form  Form1  
      Caption                  =      "MailErrorForm" 
      ClientHeight        =      5235 
      ClientLeft            =      1680 
      ClientTop              =      1530 
      ClientWidth          =      5220 
      LinkTopic              =      "Form1" 
      ScaleHeight          =      5235 
      ScaleWidth            =      5220 
      Begin  VB.TextBox  txtPassword  
            Height                    =      285 
            IMEMode                  =      3    'DISABLE 
            Left                        =      720 
            PasswordChar        =      "*" 
            TabIndex                =      7 
            Top                          =      1080 
            Width                      =      4455 
      End 
      Begin  VB.TextBox  txtUser  
            Height                    =      285 
            Left                        =      720 
            TabIndex                =      6 
            Top                          =      720 
            Width                      =      4455 
      End 
      Begin  VB.TextBox  txtBody  
            Height                    =      3135 
            Left                        =      0 
            MultiLine              =      -1    'True 
            ScrollBars            =      3    'Both 
            TabIndex                =      5 
            Top                          =      1440 
            Width                      =      5175 
      End 
      Begin  VB.TextBox  txtTo  
            Height                    =      285 
            Left                        =      720 
            TabIndex                =      3 
            Top                          =      0 
            Width                      =      4455 
      End 
      Begin  VB.TextBox  txtSubject  
            Height                    =      285 
            Left                        =      720 
            TabIndex                =      1 
            Top                          =      360 
            Width                      =      4455 
      End 
      Begin  VB.CommandButton  cmdSend  
            Caption                  =      "Send" 
            Height                    =      495 
            Left                        =      2040 
            TabIndex                =      0 
            Top                          =      4680 
            Width                      =      1215 
      End 
      Begin  MSMAPI.MAPIMessages  mpmErrorMail  
            Left                        =      3720 
            Top                          =      4560 
            _ExtentX                =      1005 
            _ExtentY                =      1005 
            _Version                =      393216 
            AddressEditFieldCount=      1 
            AddressModifiable=      0      'False 
            AddressResolveUI=      0      'False 
            FetchSorted          =      0      'False 
            FetchUnreadOnly  =      0      'False 
      End 
      Begin  MSMAPI.MAPISession  mpsErrorMail  
            Left                        =      4320 
            Top                          =      4560 
            _ExtentX                =      1005 
            _ExtentY                =      1005 
            _Version                =      393216 
            DownloadMail        =      0      'False 
            LogonUI                  =      0      'False 
            NewSession            =      0      'False 
      End 
      Begin  VB.Label  Label1  
            Caption                  =      "Password:" 
            Height                    =      255 
            Index                      =      4 
            Left                        =      0 
            TabIndex                =      9 
            Top                          =      1080 
            Width                      =      780 
      End 
      Begin  VB.Label  Label1  
            Caption                  =      "User:" 
            Height                    =      255 
            Index                      =      3 
            Left                        =      0 
            TabIndex                =      8 
            Top                          =      720 
            Width                      =      660 
      End 
      Begin  VB.Label  Label1  
            Caption                  =      "To:" 
            Height                    =      255 
            Index                      =      1 
            Left                        =      0 
            TabIndex                =      4 
            Top                          =      0 
            Width                      =      660 
      End 
      Begin  VB.Label  Label1  
            Caption                  =      "Subject:" 
            Height                    =      255 
            Index                      =      0 
            Left                        =      0 
            TabIndex                =      2 
            Top                          =      360 
            Width                      =      660 
      End 
End 
Attribute  VB_Name  =  "Form1" 
Attribute  VB_GlobalNameSpace  =  False 
Attribute  VB_Creatable  =  False 
Attribute  VB_PredeclaredId  =  True 
Attribute  VB_Exposed  =  False 
Option  Explicit Private  Sub  cmdSend_Click() 
        On  Error  GoTo  SendErrorMailError         '  Sign  on  to  the  mail  system. 
        mpsErrorMail.UserName  =  txtUser 
        mpsErrorMail.Password  =  txtPassword 
        mpsErrorMail.SignOn         '  Send  the  message. 
        mpmErrorMail.SessionID  =  mpsErrorMail.SessionID 
        mpmErrorMail.Compose 
        mpmErrorMail.RecipDisplayName  =  txtSubject 
        mpmErrorMail.RecipAddress  =  txtTo 
        mpmErrorMail.AddressResolveUI  =  False 
        mpmErrorMail.MsgSubject  =  txtSubject 
        mpmErrorMail.MsgNoteText  =  txtBody 
        mpmErrorMail.Send  False         '  Sign  off  of  the  mail  system. 
        mpsErrorMail.SignOff 
        Exit  Sub SendErrorMailError: 
        '  There  was  an  error  sending  the  mail. 
        '  Just  present  the  message. 
        MsgBox  "Error  "  &  Format$(Err.Number)  &  _ 
                "  sending  mail."  &  vbCrLf  &  _ 
                Err.Description 
        Exit  Sub 
End  Sub 
Private  Sub  Form_Resize() 
Dim  wid  As  Single 
Dim  hgt  As  Single         wid  =  ScaleWidth  -  txtTo.Left 
        If  wid  <  120  Then  wid  =  120 
        txtTo.Width  =  wid 
        txtSubject.Width  =  wid 
        txtUser.Width  =  wid 
        txtPassword.Width  =  wid         cmdSend.Move  _ 
                (ScaleWidth  -  cmdSend.Width)  /  2,  _ 
                ScaleHeight  -  cmdSend.Height 
        hgt  =  cmdSend.Top  -  txtBody.Top  -  60 
        If  hgt  <  120  Then  hgt  =  120 
        txtBody.Move  0,  txtBody.Top,  ScaleWidth,  hgt 
End  Sub 

解决方案 »

  1.   

    在正常情况下我的程序能正确的收发邮件,现在我怀疑是由于在新机器上可能缺少了Mapi32.dll这个dll,但目前我上不能判断,由于机子不在我身边,但是如果是由于缺少dll,为什么在执行Mapisession.signon之前已经执行了的Mapisession.download方法没有提示runtime error,而只有执行到signon方法的时候才出现错误,搞不懂,据MSDN上提到如果缺少mapi32.dll,会出现执行到signon会出错,但愿是这种错误.
      

  2.   

    http://www.dapha.net/vb/list.asp?id=791 
    http://www.dapha.net/vb/list.asp?id=1518 
    http://www.dapha.net/vb/list.asp?id=1517 
    http://www.dapha.net/vb/list.asp?id=1101
      

  3.   

    感谢您使用微软产品。如果您希望通过程序在Outlook中发送邮件,您首先需要Logon。在使用Logon时,您需要指定要使用的配置文件(Profile)。具体您可以参考下面的资料:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/olmthLogonX.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/olmthLogon.asp您也可以通过下面的方法得到Outlook中profile的名称:在控制面板中,双击“邮件”,点击“显示配置文件”。希望对您有帮助!本帖子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
      

  4.   

    The following table summarizes how clients retrieve version information and determine if Simple MAPI, CMC, MAPI, or the Collaboration Data Objects (CDO) Library is available on their machine.To check  Registry/WIN.INI entry 
    Availability of Simple MAPI Look for MAPI=1 
    Availability of MAPI  Look for MAPIX=1 
    Availability of CMC Look for CMC=1 
    Availability of CDO Library Look for OLEMessaging=1 
    Available version of MAPI Look for MAPIXVER string of the form:
    x.x.x ================================================================
    请参考:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/_mapi1book_installing_mapi.asp