1.

Solve : E-mailing using a batch file?

Answer»

Hey all...

I'd like to know if its possible to email out documents using BATCH files...?

Thanks in advance... I'm AWARE of 3rd party products ($) enabling batch files to do this otherwise you need a script (free):

Code: [Select]
Dim objMail: Set objEmail = CreateObject("CDO.Message")
objEmail.From = "youremailaddress"
objEmail.To = "recipientsemailaddress"
objEmail.Subject = "subject"
objEmail.Textbody = "Body"
objEmail.AddAttachment "path\filenametoattach"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "ISPservername"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send

set objEmail = Nothing
WScript.Quit


Change PARAMETERS accordingly. Do not change the sendusing or serverport parameters.

If you don't know your ISP server name call them for details.

Save script with a VBS extension.

Hope this helps.

There is a special place in *censored* for spammers Thanks for the code SideWinder

But I'm new to Batch Files and is confused... Haha..

The code that u provided do i run it in Batch File or run it using a script..? The code provided is a script. Your can run from the command prompt, or Start-->Run, or from WINDOWS Explorer. The extension must be VBS.

From the prompt or Run box you must include the VBS extension:

wscript path\myscript.vbs OR
cscript path\myscript.vbs OR
path\myscript.vbs

From Windows Explorer:

Find the file and double click it.

I also responded to your messages, so check there for for info.

Good luck.



Discussion

No Comment Found