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 = ""
MAPIMessages1.MsgSubject = "u made it"
MAPIMessages1.MsgNoteText = "god loves you"
MAPIMessages1.Send()

MAPISession1.SignOff()
End Sub
End Class

Dani AI

Generated

Because the message-fetch worked for , the MAPI session is getting created but the failure happens at the send step. Common, verifiable causes are: the MAPI profile is not writable or is locked, Outlook (or the MAPI subsystem) is blocking programmatic sends for security, the recipient/address format is not accepted by the MAPI provider, or the code is running in a non‑interactive context (services/ASP.NET), which Simple MAPI does not support. The fastest way to get useful diagnostic info is to catch the COMException and inspect the HRESULT so you can map it to a MAPI/COM error code.

For example, add a small try/catch around the send and log the exception message and HResult (VB.NET):

Try
    MAPIMessages1.Send()
Catch ex As System.Runtime.InteropServices.COMException
    Dim hr = System.Runtime.InteropServices.Marshal.GetHRForException(ex)
    Debug.WriteLine("Send failed: " & ex.Message & " HResult=0x" & hr.ToString("X"))
End Try

Troubleshooting checklist

  • Verify MAPISession.SessionID is nonzero and the same SessionID is assigned to the messages object.
  • Test with a known-valid SMTP address and a single recipient.
  • Confirm the default mail profile exists (Control Panel → Mail → Show Profiles) and Outlook can send manually with that profile.
  • Ensure the app runs as the interactive user — Simple MAPI fails from services or different user accounts.
  • Temporarily disable AV or backup tools that may lock PST/OST files.

About the popup: there are two different popups — the MAPI sign-on dialog and Outlook’s programmatic-access/security confirmation. To avoid prompts for automated server-side sending, use an SMTP solution (System.Net.Mail), Exchange Web Services / Microsoft Graph, or a trusted MAPI wrapper like Redemption if Outlook automation is required. The error reported by about a missing/locked workgroup file points to a profile or store lock; check profiles and exclusive locks before retrying.

How do your over come this error and are due to what reasons
The first error msg was say unspecified error
the second error msg showed cannot start yr application the workgroup information file is missing or opened exclusively by other user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.