Article ID: 122998
Article Last Modified on 10/30/2006
' *************************************************** ' Visual Basic equivalent of the C programming language ' sample found in the Microsoft Mail Technical Reference ' *************************************************** Dim M As MapiMessage Dim Mo As MapiRecip ReDim R(0 To 1) As MapiRecip ReDim F(0 To 0) As MapiFile NL = Chr(10) F(0).Reserved = 0& F(0).Flags = 0& F(0).Position = -1 F(0).PathName = "C:\budget17.wk3" F(0).FileName = "budget17.wk3" F(0).FileType = "" Msg1$ = "Attached is the budget proposal. " Msg2$ = "See you Monday." M.Subject = Msg1$ + Msg2$ M.MessageType = "" M.RecipCount = 2 M.FileCount = 1 R(0).Reserved = 0& R(0).RecipClass = MAPI_To R(0).Name = "Sally Jones" R(0).EIDSize = 0& R(0).EntryID = "" R(1).Reserved = 0& R(1).RecipClass = MAPI_To R(1).Name = "Marketing" R(1).EIDSize = 0& R(1).EntryID = "" rc& = MAPILogon(0&, "admin", "password", 0&, 0&, lhSession&) rc& = MAPISendMail(0&, 0&, M, R(0), F(0), 0&, 0&) If rc& <> SUCCESS_SUCCESS Then MsgBox "Unable to send the message." rc& = MAPILogoff(lhSession&, 0&, 0&, 0&) End ' **************************** ' End of source code ' ****************************To get the code to work, MAPILogon and MAPILogoff function calls have been included in the source code.
Keywords: KB122998