vbscript 从表格发送电子邮件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript 从表格发送电子邮件相关的知识,希望对你有一定的参考价值。

Private Sub Command66_Click()
Const strParent = "\\prod.atonet.gov.au\atonetshares$\Individuals_Automation\Requests\Output\"

Dim olApp As Object
Dim objMail As Object
     Dim strID As String
     Dim strDate As String
     Dim strOfficer As String
     Dim strFolder As String
     Dim strRisk As String
     Dim strUserID As String
On Error Resume Next 'Keep going if there is an error

' Request
     strTitle = Me.Title
     strID = Me.ID
     strDate = Me.Request_Date
     strOfficer = Me.Officer
     strRisk = Me.Request_Risk
     strUserID = Me.Officer_UserID
     ' Full path
     strFolder = "<a href='" & strParent & strOfficer & "\" & strID & " - " & strRisk & " - " & strTitle & "'>Results</a>"
     strBody = "<html><body><p>Hi,</p><p>Please find at the link below the results of your data request.</p>" _
    & strFolder & "<p>Any queries please let me know.</p>Regards</body></html>"
    
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open


If Err Then 'Outlook is not open
Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook
End If

'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)

With objMail
.Display
'Set body format to HTML
.BodyFormat = olFormatHTML
.To = strUserID
.Subject = strID & " " & strOfficer & " - " & strRisk & " - " & strTitle
.htmlBody = strBody & .htmlBody
.send

End With
'MsgBox "Results email has been sent"
End Sub

以上是关于vbscript 从表格发送电子邮件的主要内容,如果未能解决你的问题,请参考以下文章

vbscript [.net] [vb]从内存流发送包含附件的电子邮件

vbscript [.net] [vb]从目录发送带有文件附件的电子邮件

vbscript 使用VBScript发送电子邮件

在 vbscript 中发送多部分电子邮件

从 VBScript 使用剪贴板

vbscript 用于使用Remedy内容发送电子邮件