|
The VBScript code below will send an email message through Microsoft Outlook (the Exchange Server version, it probably won't work with Outlook Express) when you call it from your script. Using this subroutine you can customize the subject and content of the mail message as well as its recipients.
To use it, the syntax is: mailThisMessage toAddress, bccList, ccList, subjectLine, theMessage where: toAddress is the email address you want to send the message to (use ";" for multiple addresses) bccList is the list of email addresses you want to "bcc" the mail message to via Outlook
ccList is the list of email addresses you want to copy the mail message to via Outlook
subjectLine is the subject line of the message you're sending via Outlook
theMessage is a text field containing the actual message you want to send, in HTML format, via Microsoft Outlook mail
As with all my scripts and code, this is provided without warranty or support. Use at your own risk.
Public Sub mailThisMessage(toAddress As String, bccList As String, ccList As String, subjectLine As String, theMessage As String) Dim olNameSpace As Outlook.NameSpace Set olNameSpace = Outlook.GetNamespace("MAPI") Dim fldInbox As Outlook.MAPIFolder Set fldInbox = olNameSpace.GetDefaultFolder(olFolderInbox) Set themsg = fldInbox.Application.CreateItem(olMailItem) themsg.To = toAddress themsg.BCC = bccList themsg.CC = ccList themsg.Subject = subjectLine themsg.HTMLBody = theMessage themsg.Send olNameSpace.Logoff Set olNameSpace = Nothing Set themsg = Nothing Set fldInbox = Nothing End Sub
Related Blogs:
Related Links:
|