最近做一个项目,做了一个NT service,自动从数据库中读数据然后倒入到excel中,当附件发出。
当我把程序做成exe的时候没有问题,当我做成NT service时就有了问题。
我原来发邮件的class 不能用了,在xp中显示的错误为activeX can't create object, 在2000server中显示为permission denied。 
如果有谁做过相关程序,希望能够帮助一下。下面是发邮件的代码Public Function SendMail()WriteFile Now() & Space(2) & mAttachment
On Error GoTo errhandler:Dim olApp As Object, oItem As Object
Dim objNameSpace As Object
Dim olProfile As StringolProfile = IniStringGet("MailProfile", "SystemConfig")WriteFile Now() & Space(2) & olProfile
    Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
objNameSpace.logon "CSR"
Set oItem = olApp.CreateItem(0)    With oItem
        .Subject = mSubject & Now()
        .To = mMailList
        .Body = mBody
        .Attachments.Add mAttachment    
        .Send
    End With
   
    SendMail = True
    WriteFile Now() & Space(2) & "Successfully finished sendmail."
    
    Set oItem = Nothing
    Set olApp = Nothing
    Exit Function
errhandler:
  WriteFile Now() & Space(2) & Err.Description
End Function我在一台2000server上测试成功,但是到另一台2000server上就不能用了。