I would like to send an email by vbscript to an exchange server in an internal network.
On the workstation where this script should be run is no outlook(express) or other email client.
There are example VBS scripts to send to an SMTP server, but ive ditched them due to inreliabilty.
you could use 3rd party tools with a batch file, such as 'SendMail' (google it)
or i had a thought whilst reading your post, which i might try later. you can send to most SMTP servers totally manually, with no script using a telnet session in the following order
telnet smtp.server.co.uk
helo mail.mailserver.co.uk
mail from: administrator@mailserver.co.uk
rcpt to: support@bloggs.co.uk
data
subject: this is a test from Monkey
Hi
this is a test on behalf of albert
Gurner
.
quit
--------
I'm wondering if it could be scripted? i know a batch script won't work as it identifies it as a spam attempt.
It might have to be a send keys script to put the above commands into a telnet session?
Try this:
' Begin Code -------------------------------------------------
Dim oName, ODomain, oMyIP, oTo, Attach
' Set "To:" names.
T1 = "Someone@somedomain.com"
T2 = "SomeoneElse@somedomain.com"
Subject = "Email Test " & now
Body = "**********************************************************************************************" & vbCrlf & _
"**************************************Administrator Test************************************** "& vbCrlf & _
"**********************************************************************************************" & vbCrlf & _
"This is an automated message."
' Set the From name
oName = "EmailTester"
' Company Internet Domain Name
ODomain = "YourDomainHere.com"
' Set the SMTP server IP
oMyIP = "Your.SMTP.Server.Here"
' Where do you want the message to be delivered
oTo = T1 &"; "& T2
' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod = "
'// Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'// SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
'// Set the SMTP server address here.
.Item(cdoSMTPServer) = oMyIP
.Update
End With
'// Set the message properties.
With iMsg
Set .Configuration = iConf
.To = oTo
.From = oName
.Subject = Subject
.TextBody = Body
End With
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.