By David Wiseman (Administrator)Created 25 Jul 2006, Modified 23 Mar 2009
My Rating:
Vote
Rating:
Not Rated
Views:7413
Downloads:245

Send Email

Language:  VBScript

Compatibility

Windows XP Yes Windows 2003 Unknown
Windows 2000 Unknown Windows NT Unknown
Vista Unknown Windows 2008 Unknown
Description

Send Email with VBScript using CDO (Collaboration Data Objects)

Code

Line Numbers: On  Off      Plain Text
Dim objEmail
Dim fromEmail, toEmail, subject, body,strSMTP

' **** Configuration ****

fromEmail = "youremail@domain.com"
toEmail = "recipientemail@domain.com"
subject = "My Subject"
body = "My Mesage..."
strSMTP = "smtpserverhere"

' ***********************

Set objEmail = CreateObject("CDO.Message")

with objEmail
	.From = fromEmail
	.To = toEmail
	.Subject = subject
	.Textbody = body
	.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
	.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
	.Configuration.Fields.Update

	.Send
end with

set objEmail = nothing

 


Got a useful script? Click here to upload!


 

  Post Comment
Order By:  
User Comments
      
Be the first to post a comment!