Send Email with Attachment using VBScript

This is a way to send email with an attachment using an SMTP server that requires authentication. Set email = CreateObject("CDO.Message") email.Subject = "Test Email" email.From = "me@mydomain.com" email.To = "recipient@theirdomain.com" email.TextBody = "Message Text." email.AddAttachment "c:\document.txt" email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "UserName" email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "PassWord" email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.yourserver.com" email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 email.Configuration.Fields.Update email.Send set email = Nothing