|
|
|
Sometimes we need to check CDO on the server with minimum amount of time.
Following script will send an email using CDO object library. If you dont have CDO then it will throw an error.
- Create an empty file in notepad. - Copy/Paste the following script - Save file as CDOMailTest.vbs - Double click the file to test CDO
CDOMailTest.vbs |
Click here to copy the following block | Dim objMessage ,strTo,strSmtp
strTo=InputBox("Enter [To] email address",,"someone@hotmail.com")
Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "Example CDO Message" objMessage.From = "someone@binaryworld.net" objMessage.To = strTo
objMessage.TextBody = "This is some sample message text."
strSmtp=InputBox("Enter SMTP server name or IP (i.e. mail.bellsouth.com)",,"localhost")
if strSmtp<>"localhost" then objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmtp
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update end if
objMessage.Send
Msgbox "Message sent to " & strTo |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
 |

|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|