Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 25th, 2007, 8:36 PM   #1
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
Outlook

I have a class library that is supposed to send email from outlook ... i have added a reference to the Microsoft.officecore (something like that) 12 and outlook object library 12 (i have office 2007)...im calling the DLL from a C# class in an ASP.Net application

The code fails here:
msg = OutlookApp.CreateItem(OlItemType.olMailItem) 'Mail item

Code:

Imports Microsoft.Office.Interop.Outlook

Public Class Email_vb

    Public Sub sendEmail(ByVal recipient As String, ByVal subject As String, ByVal message As String)

        Dim OutlookApp As New Application 'application

        Dim msg As _MailItem
        msg = OutlookApp.CreateItem(OlItemType.olMailItem) 'Mail item  

        Dim oNameSpace As Microsoft.Office.Interop.Outlook.NameSpace
        oNameSpace = OutlookApp.GetNamespace("MAPI")

        msg.To = recipient
        msg.Subject = subject
        msg.Body = message

        msg.Send()
    End Sub

End Class

Exception Details:


System.Runtime.InteropServices.COMException was unhandled by user code
ErrorCode=-2147467259
Message="The operation failed."
Source="Microsoft Office Outlook"
StackTrace:
at Microsoft.Office.Interop.Outlook.ApplicationClass.CreateItem(OlItemType ItemType)
at sendMail.Email_vb.sendEmail(String recipient, String subject, String message) in E:\Documents and Settings\Paul\My Documents\Visual Studio 2005\Projects\sendMail\sendMail\Class1.vb:line 10
at Capstone.Email.sendEmail(String recipientEmail, String message, String subject) in F:\capstone_vs_project\Capstone\Capstone\Email.cs:line 23
at Capstone.BestOffer.alertSeller(String sellersName, String sellersEmail) in F:\capstone_vs_project\Capstone\Capstone\BestOffer.cs:line 216
at Capstone.BestOffer.contactSeller() in F:\capstone_vs_project\Capstone\Capstone\BestOffer.cs:line 186
at Capstone.BestOffer.addOffer(Double offerPrice) in F:\capstone_vs_project\Capstone\Capstone\BestOffer.cs:line 80
at Capstone.preview.submitBestOffer_Click(Object sender, EventArgs e) in F:\capstone_vs_project\Capstone\Capstone\preview.aspx.cs:line 280
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
paulchwd is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen Scraping tayspen C# 8 Feb 15th, 2006 9:36 PM
What is the outlook on outsourcing? dvu Coder's Corner Lounge 5 Nov 19th, 2005 2:29 PM
Automating a response in outlook Mjordan2nd Other Programming Languages 5 Jan 31st, 2005 11:36 PM
Application Hooks in C? robert_sun C++ 0 Jan 12th, 2005 4:44 PM
WAB sharing robert_sun Existing Project Development 2 Jan 11th, 2005 10:47 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:41 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC