I am using the MAPI code from Dave Brooks .
I am trying to program sending the generated Crystal Reports.
When I run the code without streaming, everything works fine. The problem is that when I use threading, I get the error "General MAPI failure [2]".
I had never used streams before and did not understand that there are concerns. Can anyone figure this out? NOTE. I removed exception handling to make the code more understandable.
Private Sub RunReport()
SetParameters()
SaveReportFile()
Dim operation As New ThreadStart(AddressOf SendEmail)
Dim theThread As New Thread(operation)
theThread.Start()
End Sub
Public Sub SendEmail()
Dim m As MAPI
m = New MAPI()
Dim email As String
For Each email In emailAddress
m.AddRecipientBCC(email)
Next email
m.AddAttachment(@"c:\temp\report.pdf")
m.SendMailPopup("Requested Report", "")
End Sub
source
share