hi,
i am sending u d code i hav written......when i execute it...it displays d no. of msgs in inbox n after tat gives a runtime error [ at d line: MAPIMessages1.Send() ]
saying tat:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll
Additional information: Unspecified Failure has occurred
also i would like to know how to suppress the pop up window which pops up everytime b4 sending a mail.....
Imports System
Imports MSMAPI
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim MAPISession1 = New MAPISession
Dim MAPIMessages1 = New MAPIMessages
MAPISession1.SignOn()
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Fetch()
MsgBox("You have " & MAPIMessages1.MsgCount & _
" messages in your inbox!")
'If MAPIMessages1.MsgCount > 0 Then
' For i = 0 To MAPIMessages1.MsgCount - 1
' MAPIMessages1.MsgIndex = i
' ListBox1.Items.Add("From:" & MAPIMessages1.MsgOrigDisplayName & _
' " Subject:" & MAPIMessages1.MsgSubject)
' Next
'End If
MAPIMessages1.Compose()
MAPIMessages1.RecipAddress = "prakash_james@abcd.com"
MAPIMessages1.MsgSubject = "u made it"
MAPIMessages1.MsgNoteText = "god loves you"
MAPIMessages1.Send()
MAPISession1.SignOff()
End Sub
End Class