将VBS和ASP脚本放在一起 [英] Bringing a VBS and ASP script together
问题描述
我合并并修改了这些脚本工作完全正常
只要我使用server.execute访问VBS
部分(它本身在另一个ASP文件中) )。当这些
我使用会话变量从
数据库传递电子邮件地址。我有超时问题
和缓冲区问题,据我所知,也许
a问题,更改会话变量太多
次一个会话。所以我尝试将两个脚本
放在一个页面上。当我这样做时,我收到错误
Microsoft VBScript编译错误''800a03ea''
语法错误
/ tournament-services /fbba/editor/cdo_setmail.asp,第24行
SUB sendmail(来自谁,到谁,主题,正文)
请注意,这是一个很大的电子邮件列表世界空手道
锦标赛,不是垃圾邮件列表。它有大约20,000
收件人,我从来没有做过这样的事情
因此问题。
我怎样才能得到这些在同一页面上一起工作?
这是第一个带有server.execute的脚本注释掉了
,因为我不想使用它,如果我可以得到这一切在一个页面上。
我希望这样做会结束其他错误问题。
第一个sript会让第二个替换server.execute。
第一个脚本开始:
Server.ScriptTimeout = 6000
设置objEmail = Server.CreateObject(" ADODB.Connection" )
objEmail.Open" DSN = Tournaments;",2
设置CompetitorEmail = Server.CreateObject(" ADODB.Recordset")
sqltext =" SELECT电子邮件来自Vernon_email其中的电子邮件如''%@%''订购者
电子邮件;"
CompetitorEmail.Open sqltext,objEmail
Do While not Comp etitorEmail.EOF
如果不是地址= CompetitorEmail(" Email")那么
''指定谁发送给
session(" fromWho")= CompetitorEmail(" email")
''循环通过邮件发件人
''server.execute(" CDO-vernon.asp" ;)
''第二个脚本放在这里
结束如果
地址= CompetitorEmail(" Email")
CompetitorEmail.MoveNext
循环
CompetitorEmail.close
设置CompetitorEmail = Nothing
结束第一篇文章
第二篇文章开头
''我将删除HTML正文的构建。
toWho =" de **** @ connexions.net"
Subject =" Karate Tounament NASKA / FST / FBBA:OSU! SuperStar
邀请赛 - Vernon Jones Jr."
''正是这个SUB导致语法提醒
SUB sendmail(fromWho,toWho,Subject,Body)
Dim objCDO
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 2
设置objCDO = Server.CreateObject(" CDO.Message")
设置iConf = Server.CreateObject(" CDO.Configuration")
设置Flds = iConf.Fields
使用Flds
.Item(cdoSendUsingMethod)= cdoSendUsingPickup
.Item( " smtpserverpickupdirectory")=" c:\ Inetpub \ mailroot \ pickup"
.Item(cdoFlushBuffersOnWrite)= true
.item(Response.Buffer) = False
.Item(cdoSMTPServer)=" mailforward.connexions.net"
。更新
''HTML Body在这里构建
结束
设置objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.HTMLbody = strHTML
''objCDO.AddAttachment
objCDO.Send
END SUB
如果toWho<> ""那么
发送邮件从谁,到谁,主题,身体
结束如果
''清理
设置ObjCDO = Nothing
设置iConf = Nothing
设置Flds = Nothing
END SECOND SCRIPT
>
如上所述,当我将第二个
脚本放入第一个中间时,SUB错误
作为不正确的语法。我真的很喜欢这里
并且不知道可以做些什么来纠正这个问题。
感谢任何指示,
Fox
I merged and modified these script which work perfectly fine
as long as I use server.execute to access the VBS
part (which is itself in another ASP file). When these
I use a session variable to pass an email address from
the database. I have had timeout problems
and buffer problems and as I understand it, maybe
a problem with changing the session variable too many
times in one session. So I tried putting the two scripts
on one page. When I do I get the error
Microsoft VBScript compilation error ''800a03ea''
Syntax error
/tournament-services/fbba/editor/cdo_setmail.asp, line 24
SUB sendmail( fromWho, toWho, Subject, Body )
Note that this is a large email list for a World Karate
Tournament and is not a spam list. It has about 20,000
recipients and I have never done anything like this
hence the problems.
How can I get these to work together on the same page?
Here is the first script with the server.execute commented out
since I do not want to use it if I can get this all on one page.
I am hoping that doing that will end the other error problems.
The first sript will have the second replace the server.execute.
FIRST SCRIPT BEGIN:
Server.ScriptTimeout = 6000
Set objEmail= Server.CreateObject("ADODB.Connection")
objEmail.Open "DSN=Tournaments;",2
Set CompetitorEmail = Server.CreateObject("ADODB.Recordset")
sqltext = "SELECT Email FROM Vernon_email Where Email like ''%@%'' Order By
Email;"
CompetitorEmail.Open sqltext, objEmail
Do While not CompetitorEmail.EOF
If not address = CompetitorEmail("Email") then
''assign who to send to
session("fromWho") = CompetitorEmail("email")
''cycle through mail sender
''server.execute("CDO-vernon.asp")
''the second script was placed here
end if
address = CompetitorEmail("Email")
CompetitorEmail.MoveNext
Loop
CompetitorEmail.close
Set CompetitorEmail = Nothing
END FIRST SCRIPT
SECOND SCRIPT STARTS
''I will remove the building of the HTML body.
toWho = "de****@connexions.net"
Subject = "Karate Tounament NASKA/FST/FBBA: OSU! The SuperStar
Invitational - Vernon Jones Jr."
''it is this SUB that causes the syntax alert
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 2
Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPickup
.Item("smtpserverpickupdirectory")= "c:\Inetpub\mailroot\pickup"
.Item(cdoFlushBuffersOnWrite) = true
.item(Response.Buffer) = False
.Item(cdoSMTPServer) = "mailforward.connexions.net"
.Update
''The HTML Body is built here
End With
Set objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.HTMLbody = strHTML
''objCDO.AddAttachment
objCDO.Send
END SUB
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body
END IF
''Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
END SECOND SCRIPT
As mentioned above, when I put this second
script into the middle of the first, the SUB errors
as incorrect syntax. I am really over my head here
and do not know what can be done to rectify this.
Thanks for any pointers,
Fox
推荐答案
你能否显示导致错误的组合代码?
雷在家
" Fox" < fox @ connexions .net>在消息中写道
news:uv ************** @ TK2MSFTNGP10.phx.gbl ...
Can you show the code combined that is causing the error?
Ray at home
"Fox" <fox @ connexions .net> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
我合并并修改了这些哪个脚本工作得很好
如上所述,当我把第二个
脚本放到第一个中间时,SUB错误就像语法不正确一样。我真的很喜欢这里
并且不知道可以做些什么来纠正这个。
感谢您的任何指示,
Fox
I merged and modified these script which work perfectly fine
As mentioned above, when I put this second
script into the middle of the first, the SUB errors
as incorrect syntax. I am really over my head here
and do not know what can be done to rectify this.
Thanks for any pointers,
Fox
谢谢你看看Ray!
因为CDO部分不是我熟悉的东西
,我不知道如何在一个脚本中组合各个部分
。这是
a原始组合的样子。
Fox
Server.ScriptTimeout = 6000
设置objEmail = Server.CreateObject(ADODB.Connection)
objEmail.OpenDSN =锦标赛;,2
设置CompetitorEmail = Server.CreateObject(" ADODB.Recordset")
sqltext =" SELECT电子邮件来自Vernon_email电子邮件如''%@%''订购者
电子邮件;"
CompetitorEmail.Open sqltext,objEmail
做的不是CompetitorEmail.EOF
如果不是地址= CompetitorEmail( 电子邮件)然后
''指派谁发送给
toWho = CompetitorEmail(" email")
fromWho = se****@mydomain.com
主题=空手道战争NASKA / FST / FBBA:俄勒冈州立大学! SuperStar
邀请赛 - Vernon Jones Jr."
''正是这个SUB导致语法提醒
SUB sendmail(fromWho,toWho,Subject,Body)
Dim objCDO
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 2
设置objCDO = Server.CreateObject(" CDO.Message")
设置iConf = Server.CreateObject(" CDO.Configuration")
设置Flds = iConf.Fields
使用Flds
.Item(cdoSendUsingMethod)= cdoSendUsingPickup
.Item( " smtpserverpickupdirectory")=" c:\ Inetpub \ mailroot \ pickup"
.Item(cdoFlushBuffersOnWrite)= true
.Item(Response.Buffer) = False
''因使用皮卡而可能不需要
.Item(cdoSMTPServer)=" mailforward.connexions.net"
。更新
strHTML ="< html>< head>" &安培; vbCRLF
strHTML = strHTML& < title> KARATE TOURNAMENT:佛罗里达州的超级明星
邀请赛(由Vernon Jones Jr。撰写)< / title>< / head>" &安培; vbCRLF
strHTML = strHTML& "< body bgcolor = 000000 link = ffffff>< center>" &安培; vbCRLF
''剩下的HTML正文将在这里
结束用
设置objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.HTMLbody = strHTML
''objCDO.AddAttachment
objCDO.Send
END SUB
如果toWho<> ""然后
发送邮件从谁,到谁,主题,身体
结束如果
''清理
设置ObjCDO = Nothing
设置iConf = Nothing
设置Flds = Nothing
结束如果
地址= CompetitorEmail(" Email")
CompetitorEmail.MoveNext
循环
CompetitorEmail.close
设置CompetitorEmail = Nothing
" Ray at<%= sLocation%>" < myFirstNameATlane34dotKOMM>写在留言中
新闻:uW ************** @ TK2MSFTNGP10.phx.gbl ...
Thanks for taking a look Ray!
Since the CDO part is not something I am familiar
with, I do not know how to combine the sections
in the one script. Here is what it would look like with
a raw combining.
Fox
Server.ScriptTimeout = 6000
Set objEmail= Server.CreateObject("ADODB.Connection")
objEmail.Open "DSN=Tournaments;",2
Set CompetitorEmail = Server.CreateObject("ADODB.Recordset")
sqltext = "SELECT Email FROM Vernon_email Where Email like ''%@%'' Order By
Email;"
CompetitorEmail.Open sqltext, objEmail
Do While not CompetitorEmail.EOF
If not address = CompetitorEmail("Email") then
''assign who to send to
toWho = CompetitorEmail("email")
fromWho = se****@mydomain.com
Subject = "Karate Tounament NASKA/FST/FBBA: OSU! The SuperStar
Invitational - Vernon Jones Jr."
''it is this SUB that causes the syntax alert
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 2
Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPickup
.Item("smtpserverpickupdirectory")= "c:\Inetpub\mailroot\pickup"
.Item(cdoFlushBuffersOnWrite) = true
.Item(Response.Buffer) = False
''probably not needed since using the pickup
.Item(cdoSMTPServer) = "mailforward.connexions.net"
.Update
strHTML="<html><head>" & vbCRLF
strHTML = strHTML & "<title>KARATE TOURNAMENT: Florida''s SuperStar
Invitational (by Vernon Jones Jr.)</title></head>" & vbCRLF
strHTML = strHTML & "<body bgcolor=000000 link=ffffff><center>" & vbCRLF
''rest of HTML body would be here
End With
Set objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.HTMLbody = strHTML
''objCDO.AddAttachment
objCDO.Send
END SUB
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body
END IF
''Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
end if
address = CompetitorEmail("Email")
CompetitorEmail.MoveNext
Loop
CompetitorEmail.close
Set CompetitorEmail = Nothing
"Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
你能否展示代码导致错误的组合?
雷在家
Can you show the code combined that is causing the error?
Ray at home
新闻:uv ************** @ TK2MSFTNGP10.phx.gbl。 ..
news:uv**************@TK2MSFTNGP10.phx.gbl...
福克斯 < fox @ connexions .net>在消息中写道
"Fox" <fox @ connexions .net> wrote in message
我合并并修改了这些完美无缺的脚本
如上所述,我将第二个
脚本放在第一个中间,SUB错误
作为不正确的语法。我真的很喜欢这里
并且不知道可以做些什么来纠正这个。
感谢您的任何指示,
Fox
I merged and modified these script which work perfectly fine
As mentioned above, when I put this second
script into the middle of the first, the SUB errors
as incorrect syntax. I am really over my head here
and do not know what can be done to rectify this.
Thanks for any pointers,
Fox
一些好消息!
我想我有它的工作。我正在做一个测试,发送给自己。
我已经超过7,000了,它还在继续。我已经有了一个问题
我会在这次finshes或崩溃之后发布。但是,如果
有人/ Ray会开始提供帮助,我想让你知道
脚本已被编辑并改进到了这一点
它现在正在发送邮件。
我不想浪费任何人的时间。
谢谢,
Fox
" Fox" < fox @ connexions .net>在留言中写道
news:uN ************** @ TK2MSFTNGP10.phx.gbl ...
Some good news !
I think I have it working. I am doing a test, sending to myself.
I''m past 7,000 and it''s still going. I already have a question
which I will post after this finshes or crashes. But, in case
anyone/Ray would be starting to help, I wanted to let you know
that the script has been edited and improved to the point
that it is now sending the mail.
I Don''t want to waste anyone''s time.
Thanks,
Fox
"Fox" <fox @ connexions .net> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
谢谢你看看Ray!
由于CDO部分不是我熟悉的部分,我不知道如何在一个脚本中组合部分
。这是原始组合的样子。
Fox
Server.ScriptTimeout = 6000
设置objEmail = Server.CreateObject(" ADODB.Connection" ;)
objEmail.Open" DSN = Tournaments;",2
设置CompetitorEmail = Server.CreateObject(" ADODB.Recordset")
sqltext =" SELECT电子邮件来自Vernon_email其中的电子邮件如''%@%''按订单发送电子邮件;&#;> CompetitorEmail.Open sqltext,objEmail
请勿竞争电子邮件.EOF >如果不是地址= CompetitorEmail(电子邮件)那么
''指定谁发送到
toWho = CompetitorEmail(" email)
fromWho = se **** @ mydomain.com
主题=空手道TIGament NASKA / FST / FBBA:OSU! SuperStar
Invitational - Vernon Jones Jr."
''正是这个SUB导致语法警报
SUB sendmail(来自Who,toWho,Subject,Body)
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 2
设置objCDO = Server.CreateObject(" CDO.Message")
设置iConf = Server .CreateObject(" CDO.Configuration")
设置Flds = iConf.Fields
使用Flds
。Item(cdoSendUsingMethod)= cdoSendUsingPickup
.Item(" smtpserverpickupdirectory")=
" c:\ Inetpub \ mailroot \ pickup" .Item(cdoFlushBuffersOnWrite)= true
.Item(Response.Buffer)= False
''因使用拾取器可能不需要
.Item(cdoSMTPServer)=" mailforward.connexions.net" ;
。更新
strHTML ="< html>< head>" &安培; vbCRLF
strHTML = strHTML& < title> KARATE TOURNAMENT:佛罗里达州的SuperStar
邀请赛(由Vernon Jones Jr。撰写)< / title>< / head>" &安培; vbCRLF
strHTML = strHTML& "< body bgcolor = 000000 link = ffffff>< center>" &安培; vbCRLF
'其余的HTML正文将在这里结束
设置objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.HTMLbody = strHTML
''objCDO.AddAttachment
objCDO.Send
END SUB
如果到了<> ""那么
发送邮件从谁,到谁,主题,身体
结束如果
''清理
设置ObjCDO =什么都没有
设置iConf =没什么
设置Flds = Nothing
结束如果
地址= CompetitorEmail(" Email")
CompetitorEmail.MoveNext
循环
CompetitorEmail.close
设置CompetitorEmail = Nothing
" Ray at<%= sLocation%>" < myFirstNameATlane34dotKOMM>在消息中写道
新闻:uW ************** @ TK2MSFTNGP10.phx.gbl ...
Thanks for taking a look Ray!
Since the CDO part is not something I am familiar
with, I do not know how to combine the sections
in the one script. Here is what it would look like with
a raw combining.
Fox
Server.ScriptTimeout = 6000
Set objEmail= Server.CreateObject("ADODB.Connection")
objEmail.Open "DSN=Tournaments;",2
Set CompetitorEmail = Server.CreateObject("ADODB.Recordset")
sqltext = "SELECT Email FROM Vernon_email Where Email like ''%@%'' Order By
Email;"
CompetitorEmail.Open sqltext, objEmail
Do While not CompetitorEmail.EOF
If not address = CompetitorEmail("Email") then
''assign who to send to
toWho = CompetitorEmail("email")
fromWho = se****@mydomain.com
Subject = "Karate Tounament NASKA/FST/FBBA: OSU! The SuperStar
Invitational - Vernon Jones Jr."
''it is this SUB that causes the syntax alert
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 2
Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPickup
.Item("smtpserverpickupdirectory")= "c:\Inetpub\mailroot\pickup" .Item(cdoFlushBuffersOnWrite) = true
.Item(Response.Buffer) = False
''probably not needed since using the pickup
.Item(cdoSMTPServer) = "mailforward.connexions.net"
.Update
strHTML="<html><head>" & vbCRLF
strHTML = strHTML & "<title>KARATE TOURNAMENT: Florida''s SuperStar
Invitational (by Vernon Jones Jr.)</title></head>" & vbCRLF
strHTML = strHTML & "<body bgcolor=000000 link=ffffff><center>" & vbCRLF
''rest of HTML body would be here
End With
Set objCDO.Configuration = iConf
objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.HTMLbody = strHTML
''objCDO.AddAttachment
objCDO.Send
END SUB
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body
END IF
''Cleanup
Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
end if
address = CompetitorEmail("Email")
CompetitorEmail.MoveNext
Loop
CompetitorEmail.close
Set CompetitorEmail = Nothing
"Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
你能否显示导致的代码组合错误?
雷在家
Can you show the code combined that is causing the error?
Ray at home
新闻:uv ************** @ TK2MSFTNGP10.phx.gbl ...
news:uv**************@TK2MSFTNGP10.phx.gbl...
" Fox" < fox @ connexions .net>在消息中写道
"Fox" <fox @ connexions .net> wrote in message
我合并并修改了这些完美无缺的脚本
如上所述,我将第二个
脚本放在第一个中间,SUB错误
作为不正确的语法。我真的很喜欢这里
并且不知道可以做些什么来纠正这个。
感谢您的任何指示,
Fox
I merged and modified these script which work perfectly fine
As mentioned above, when I put this second
script into the middle of the first, the SUB errors
as incorrect syntax. I am really over my head here
and do not know what can be done to rectify this.
Thanks for any pointers,
Fox
这篇关于将VBS和ASP脚本放在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!