Thursday 6 June 2013

Using VB Scripting to send a mail from your outlook



This is one of the easiest way to automate email sending through outlook using VB Script.

Pre-Requsite:
1. Keep your outlook open.
2. Provide the file location in the script

Here goes the VB Script

Dim outobj,mailobj
Set outobj = CreateObject("Outlook.Application")
Set mailobj = outobj.CreateItem(0)
With mailobj
.To = ToEmailID
.Subject = "Any Subject you like"
.Body = ""
.Attachments.Add " C:\testfile.txt"
  .Send
End With

1 comment: