Send Email from Microsoft Outlook in vb.net.
  • Imports System.Net
    Imports System.Net.Mail
    Imports Microsoft.Office.Interop


    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 + ";" + txtcc.Text ' 
    newMail.SaveSentMessageFolder = fdMail

    newMail.Send()
    MessageBox.Show("Email Send To : " + txtto.Text + " ; " + txtcc.Text, "Email send succesfully")Email Send To :
    for further details and related topics http://www.codecorner.somee.com/
  • 1 Comment sorted by
  • The german users will find a well commented code snipped for an outlook sendmail function at datenspektakel.de



Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

Top Posters Weekly

Optimum Creative