gfard Posted April 15, 2003 Posted April 15, 2003 Hi how can I sending email by using vb.net? thanks Quote
*Experts* Bucky Posted April 15, 2003 *Experts* Posted April 15, 2003 Look into the System.Web.Mail namespace: [mshelp]ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebMail.htm[/mshelp] Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
hog Posted April 17, 2003 Posted April 17, 2003 What sort of email are you wanting to send, Outlook?, WEB? Quote My website
gfard Posted April 17, 2003 Author Posted April 17, 2003 sending outlook emailes! I want to send outlook eamiles by using vb.net through my application. Quote
hog Posted April 18, 2003 Posted April 18, 2003 (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 April 19, 2003 by Squirm Quote My website
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.