0

Sending Email via VBScript

VBScript

My buddy EV posted on how to send email via MS SQL Server . Not to be out done, here is how to send email via VBScript.

Sending an email from VBScript is pretty easy. Here is a basic example. Note that you will have to identify your SMTP Server. Also, "& _" was added to make it a little easier to read. It should work this way, but you can also remove the "& _" and have the line below it on the same line as it (if that makes sense).

Set objEmail = CreateObject("CDO.Message")
objEmail.Configuration.Fields.Item( & _
"http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item( & _
"http://schemas.microsoft.com/cdo/configuration/smtpserver") = &_
"some.smtp.server.com"
objEmail.Configuration.Fields.Item( & _
"http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update

objEmail.From = "me@something.com"
objEmail.To = "someone@something.com"
objEmail.Subject = "Test Message"
objEmail.Textbody = "This is a test message."
objEmail.Send
Set objEmail = nothing
tags:
VBScript
Matthew said:
 
Fro,

Is there a way to run this code without the weblinks? I am using this in a script it works beautifully!

Thanks!
 
posted 767 days ago
Add Comment Reply to: this comment OR this thread
 
Fro said:
 
@Matthew - Not that I know of. I think they're just configuration instructions for the CDO object.
 
posted 767 days ago
Add Comment Reply to: this comment OR this thread
 
sunny said:
 
no yar that not good
give us detail where to add this
how to add event which event in
yar kis object ke kiss event men likhna hy ye to batao
 
posted 537 days ago
Add Comment Reply to: this comment OR this thread
 

Search