VB通过OUTLOOK发邮件,邮件一直在OUTBOX里,一直到OUTLOOK下次启动才能发出去,如何解决?

时间:2022-08-19 06:05:13
如题,代码如下

            Dim application As Outlook.Application
            application = CreateObject("Outlook.Application")

            Dim ns As Outlook.NameSpace
            ns = application.GetNamespace("MAPI")
            ns.Logon()

            Dim emailItem As Outlook.MailItem
            emailItem = application.CreateItem(Outlook.OlItemType.olMailItem)

            Dim body As String = New String("")
            body = "Hello," + vbCrLf + vbCrLf
            With emailItem
                .Subject = "Hello"
                .To = "hello@csdn.net"
                .BodyFormat = Outlook.OlBodyFormat.olFormatRichText
                .Body = body
                .Display()
            End With

            ns.Logoff()
            ns = Nothing
            emailItem = Nothing
            application = Nothing

1 个解决方案

#1


你的Send命令呢?

#1


你的Send命令呢?