[英]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.