Imports Outlook = Microsoft.Office.Interop.Outlook Public Class InputForm Private Sub EmailTeam_Click(sender As Object, e As EventArgs) Handles EmailTeam.Click Dim Subject As String Dim Recipient As String Dim Message As String Subject = "My Team" Recipient = "myemail@address" Message = " Team details" SendOutlookMail(Subject, Recipient, Message) End Sub Public Sub SendOutlookMail(Subject As String, Recipient As _ String, Message As String) On Error GoTo errorHandler Dim oLapp As Outlook.Application Dim oItem As Object oLapp = CreateObject("Outlook.application") oItem = oLapp.CreateItem(0) With oItem .Subject = Subject .To = Recipient .body = Message .Display() '.Send() End With oLapp = Nothing oItem = Nothing Exit Sub errorHandler: oLapp = Nothing oItem = Nothing Exit Sub End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)