Implement xp_sendmail in VBS

2019-09-07 02:28发布

ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=mydb;Data Source=myserver" 
Set dbconn = CreateObject("ADODB.Connection")
dbconn.Open ConnectionString

DIM cmd
SET cmd = server.CreateObject("ADODB.Command")
SET cmd.ActiveConnection = Connection

cmd.CommandText = "xp_sendmail"
cmd.CommandType = 4 

cmd.Parameters("@Recipients") = "me@me.com" 
cmd.Parameters("@Subject") = "Test" 
cmd.Parameters("@message") = "Test" 

cmd.Execute

My script gives me an error:

Object required: 'server'

Any help will be appreciated. Thanks!

1条回答
对你真心纯属浪费
2楼-- · 2019-09-07 03:19

Look here to learn why and how to .Append parameters.

查看更多
登录 后发表回答