08-06-2008, 11:03 AM
Use this vbscript. For sending email.
Create a text file and save one or more email addresses in that file. eg.
"c:\email.txt" will have the following entries
abc@abc.com
def@abc.com
etc@etc.com
Create a vbs file, this will be responsible for sending emails. Say this is email.vbs
Create a text file and save one or more email addresses in that file. eg.
"c:\email.txt" will have the following entries
abc@abc.com
def@abc.com
etc@etc.com
Create a vbs file, this will be responsible for sending emails. Say this is email.vbs
Code:
strofile = "c:\email.txt"
'Open the file for reading
Set fso = CreateObject("Scripting.FileSytemObject")
'Get the email addresses
Set ObjInpFile = fso.OpenTextFile(strofile,1)
inpdata = Split(objInpfile,ReadAll,vbnewline)
Dim ObjEmail
For each strdata in inpdata
set objEmail = CreateObject("CDO.Message")
ObjEmail.from = "someone@somewhere.com"
ObjEmail.to = strdata
ObjEmail.Subject = "Some subject"
ObjEmail.Textbody = "Text Body"
'SMTP Server Config
ObjEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your smtp server name"
ObjEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjEmail.Send
Next
ObjInpFile.close
Set ObjEmail = Nothing