Sending E-mail through Outlook using


This example shows how to add e-mail to Microsoft Outlook outbox using VB.Net .The most improtant point here to get this working is to add a reference to “Microsoft Outlook object library”, In case of Microsoft Outlook 2002, Add “Microsoft Outlook 9.0 object library” (Right click on the project -> Add References -> Select the COM tab -> Select “Microsoft Outlook 9.0 object library”.


Public Class Form1

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click

If (txtTo.Text.Length > 0 And txtSubject.Text.Length > 0 And txtBody.Text.Length > 0) Then


Dim ol As New Outlook.Application()
Dim ns As Outlook.NameSpace
Dim fdMail As Outlook.MAPIFolder

ns = ol.GetNamespace(“MAPI”)
ns.Logon(, , True, True)

‘creating a new MailItem object
Dim newMail As Outlook.MailItem

‘gets defaultfolder for my Outlook Outbox
fdMail = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox)

‘assign values to the newMail MailItem
newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem)
newMail.Subject = txtSubject.Text
newMail.Body = txtBody.Text
newMail.To = txtTo.Text
newMail.SaveSentMessageFolder = fdMail


Catch ex As Exception

Throw ex

End Try

End If

End Sub

End Class



10 Responses to Sending E-mail through Outlook using

  1. Phillipa says:

    Thanks so much for this code – it worked a dream.

  2. umesh says:

    Thanks so much for this code and i really appreciate you hard work for others.

  3. Ian says:

    works like a charm. thank you!

  4. Petrus says:

    After adding

    “Imports Outlook = Microsoft.Office.Interop.Outlook”

    to the top it worked perfectly.


  5. wow guild recruitment…

    […]Sending E-mail through Outlook using « Technology Weblog[…]…

  6. Ramzan says:

    yes, this very gud code, after this i can explore my self.

  7. Wouter says:

    Great man .. works fine!

  8. Please let me know if you’re looking for a writer for your weblog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d really like to
    write some content for your blog in exchange for a link back to
    mine. Please shoot me an email if interested. Cheers!

  9. ipad3 says:

    Excellent post. Keep writing such kind of info
    on your page. Im really impressed by your blog.
    Hey there, You’ve performed an excellent job. I’ll certainly digg it and individually recommend to my friends.

    I’m confident they’ll be benefited from this site.

  10. My brother recommended I might like this blog. He was entirely right.
    This post actually made my day. You can not imagine simply how much
    time I had spent for this info! Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: