Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

Look into the System.Web.Mail namespace:

 

[mshelp]ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebMail.htm[/mshelp]

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted (edited)

This is what I use:

 


    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

 

you need to reference Interop.Outlook.dll for this to work.

 

[edit]Yes it is [vb][/vb][/edit]

Edited by Squirm
My website

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...