When setting up an anonymous SMTP server or when you occasionally need to test certain parameters it is handy to have a script to streamline the process.The script below will prompt for all the relevant fields:
- FROM email address
- TO email address
- Subject
- Body
- SMTP server address
It is also quite simple to modify should you want to keep some of the fields static / edit the default values.
Save the script below as a .vbs file.
Set objEmail = CreateObject("CDO.Message")
objEmail.From = Inputbox("Spefify the FROM: address","VB SMTP","testfrom@mail.com")
objEmail.To = Inputbox("Spefify the TO: address","VB SMTP","testto@mail.com")
objEmail.Subject = Inputbox("Spefify the SUBJECT: address","VB SMTP","Message Subject")
objEmail.Textbody = Inputbox("Spefify the MESSAGE BODY:","VB SMTP","This is the email body")
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = Inputbox("Spefify the SMTP server: name or IP address","VB SMTP")
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send

No comments:
Post a Comment