Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Late Binding outlook object

$
0
0
i use this code to send emails via outlook, it works fine if outlook is open and returns an exception otherwise, is there a way to send emails while outlook closed
here is my code:
Code:

Try
            Dim oApp, oemail As Object
            oApp = CreateObject("Outlook.Application")
            oemail = oApp.createitem(0)
            With oemail

                .To ="me@test.com"
                .CC = ""
                .Subject = "Test Email"
                '.BodyFormat = olFormatPlain
                .Body = "Email Body"           
                '.Save()
                '.Display()
                .Send() 'You can automatically send the email without displaying it.
            End With
            oemail = Nothing
            ' oApp.Quit()
            oApp = Nothing
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try


Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>