[英]Send Outlook Email with Table in VB.net
我正在使用以下代碼來生成並打開Outlook電子郵件。 但是我需要能夠插入帶有一些變量的表,而我當前的方法只允許使用基本文本,有人可以建議一種可以集成表的方法嗎?
Try
lblStatus.Text = "Opening OutLook Mail, Please Wait..."
My.Application.DoEvents
Dim Outl As Object
Outl = CreateObject("Outlook.Application")
If Outl IsNot Nothing Then
Dim omsg As Object
omsg = Outl.CreateItem(0)
omsg.body = "Table should go here"
omsg.To = "*address goes here"
omsg.subject = SubjectLine
'set message properties here...'
omsg.Display(false) 'will display message to user
lblStatus.Text = "Outlook Mail Template Opened."
My.Application.DoEvents
End If
Catch ex As Exception
lblStatus.Text = "Opening OutLook Mail | Error Encountered"
My.Application.DoEvents
'log error
End Try
這是表格需要的示例:
顯然,Outlook使用了格式化代碼,但我不知道如何將其從Visual Basic發送到電子郵件中。
首先從代碼中獲取DoEvents()。 他們沒有任何幫助。
對於表,最簡單的方法是將消息正文構建為包含表的HTML字符串。 當然,這要求電子郵件接收方接受HTML。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.