Currently, I am attempting to send an email using VB.NET. Now, I have added a reference with this code: (I have added placeholders)
Module Module1
Sub Main()
Create an Outlook application.
Dim oApp As Outlook._Application
oApp = New Outlook.Application()
Create a new MailItem.
Dim oMsg As Outlook._MailItem
oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oMsg.Subject = "Send Attachment Using OOM in Visual Basic .NET"
oMsg.Body = "Hello World" & vbCr & vbCr
TODO: Replace with a valid e-mail address.
oMsg.To = "user@example.com"
Add an attachment
TODO: Replace with a valid attachment path.
Dim sSource As String = "C:TempHello.txt"
TODO: Replace with attachment name
Dim sDisplayName As String = "Hello.txt"
Dim sBodyLen As String = oMsg.Body.Length
Dim oAttachs As Outlook.Attachments = oMsg.Attachments
Dim oAttach As Outlook.Attachment
oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName)
Send
oMsg.Send()
Clean up
oApp = Nothing
oMsg = Nothing
oAttach = Nothing
oAttachs = Nothing
End Sub
End Module
如何参考所有展望项目的工作(参考文献)。 应用程序,《展望》。 附文《展望》。
提前感谢。