.
# VB.NET
A related article describes how to use the MAPISendMail function provided by MAPI32.dll.
<DllImport("MAPI32.DLL")> _
Private Shared Function MAPISendMail(ByVal sess As IntPtr,
ByVal hwnd As IntPtr, ByVal message As MapiMessage,
ByVal flg As Integer, ByVal rsv As Integer) As Integer
End Function
Private Function SendMail(ByVal strSubject As String,
ByVal strBody As String, ByVal how As Integer) As Integer
Dim msg As MapiMessage = New MapiMessage()
msg.subject = strSubject
msg.noteText = strBody
msg.recips = GetRecipients(msg.recipCount)
msg.files = GetAttachments(msg.fileCount)
m_lastError = MAPISendMail(New IntPtr(0), New IntPtr(0), msg, how,
0)
If m_lastError > 1 Then
MessageBox.Show("MAPISendMail failed! " + GetLastError(),
"MAPISendMail")
End If
Cleanup(msg)
Return m_lastError
End Function
Hope this helps someone who might be here like me.
source
share