Wednesday, November 2, 2011

Send mail in VBScript

Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = Subject
.HTMLBody = TextBody
.Recipients.Add (aTo)
Const olOriginator = 0
.Send
End With
End Sub

No comments: