I get this error:
C:\sendmail.vbs(4, 1) Microsoft VBScript runtime error: Class not defined: 'vbSendMail'
Main Topics
Browse All TopicsHow do I script the following commands, instead of having to type them one-by-one in command line?
If I type these commands in command line, the mail is sent:
telnet mail.test.com 25
EHLO test.com
MAIL FROM:Admin@test.com
RCPT TO: User@test.Com
DATA
Subject: test message
text
text
.
QUIT
(mail.test.com is a mail server on my LAN)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You cannot script Telnet directly, but you could try Blat.exe from http://www.blat.net/
and then run a vbs with something like:
'=========================
strMessage = "Body text"
strSubject = 'Subject line"'
strSender = "somebody@@mysite.local"
strRecipients = "somebody1@@mysite.local, somebody2@@mysite.local"
strExchangeServer = "Your_server_NETBIOS_NAME or IP"
Set objShell = CreateObject("Wscript.Shel
objShell "%comspec% /c Blat " & strMessage & " -f " & strSender & " -t " & strRecipients & " -server " & strExchangeServer & " -s " & strSubject & " -q", 1, True
'=========================
But I haven't tested this, so let me know how you go....
Regards,
Rob.
Mortaza, the way that the sendmail code is written in the link you provided, it looks like strict VB6, and would not be compatible with VBScript because of the type declarations. Gateguard, if you have VB6, run this code in that.
Otherwise, my vbs script should run (as long as you have blat.exe) on Windows 2000 or later.
Regards,
Rob.
Try this code. It's not telnet, it uses the outlook application installed on your system.
Dim ToAddress
Dim MessageSubject
Dim MessageBody
Dim MessageAttachment
Dim ol, ns, newMail
ToAddress = "John.Smith@place.com" ' change this...
MessageSubject = "My Subject"
MessageBody = "DATA"
Set ol = WScript.CreateObject("Outl
Set ns = ol.getNamespace("MAPI")
ns.logon "","",true,false
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf
' validate the recipient, just in case...
Set myRecipient = ns.CreateRecipient(ToAddre
myRecipient.Resolve
If Not myRecipient.Resolved Then
MsgBox "unknown recipient"
Else
newMail.Recipients.Add(myR
newMail.Send
End If
Set ol = Nothing
If you want to use VBScript here is a script that works using CDO:
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Set objMessage = CreateObject("CDO.Message"
objMessage.Subject = "Test Message"
objMessage.Sender = "user@domain.com"
objMessage.From = "user@domain.com"
objMessage.To = "recipient@domain.com"
objMessage.TextBody = "Test"
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.F
("http://schemas.microsoft
'Name or IP of Remote SMTP Server
objMessage.Configuration.F
("http://schemas.microsoft
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.F
("http://schemas.microsoft
'Your UserID on the SMTP server
'objMessage.Configuration.
'("http://schemas.microsof
'Your password on the SMTP server
'objMessage.Configuration.
'("http://schemas.microsof
'Server port (typically 25)
objMessage.Configuration.F
("http://schemas.microsoft
'Use SSL for the connection (False or True)
objMessage.Configuration.F
("http://schemas.microsoft
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.F
("http://schemas.microsoft
objMessage.Configuration.F
objMessage.Send
If Err.number <> 0 then
response.write Err.number & " " & Err.Description & "<BR>"
End If
Business Accounts
Answer for Membership
by: Mortaza_doulatyPosted on 2007-05-31 at 13:40:11ID: 19191322
You can use an alternative way, use the code like this one: ShowCode.A sp?ID=109
http://www.freevbcode.com/