Try
Dim olNameSpace As Outlook.NameSpace
Dim objOutlook As Outlook.Application
Dim objNewMail As Outlook.MailItemClass
' create an outlook mail message
objOutlook = New Outlook.Application()
objOutlook.Session.Logon(NewSession:=False)
olNameSpace = objOutlook.GetNamespace("MAPI")
objNewMail = objOutlook.CreateItem(Outlook.OlItemType.olMailItem)
' format the body of the message
strBody = gstrApplicationName & " has generated the following error: " & vbCrLf & vbCrLf & strBody & _
vbCrLf & vbCrLf & "Please contact this user as soon as possible"
' finalise message detail then send
With objNewMail
.To = gstrRecipient
.Recipients.ResolveAll()
.Subject = gstrSubject
.Body = strBody
.Send()
End With
Catch objException As Exception
System.Windows.Forms.MessageBox.Show("An error has occured whilst attempting to send the email" & _
ControlChars.CrLf & ControlChars.CrLf & "If the problem persists " & _
"please contact the System Administrator", "pjhError.dll ~ Error", Windows.Forms.MessageBoxButtons.OK, Windows.Forms.MessageBoxIcon.Error)
End Try