带有记录集的ASP电子邮件

时间:2014-05-22 16:11:50

标签: database vbscript asp-classic dreamweaver recordset

我在asp中设计。

需要通过获取表InspectionCalendar中的信息在特定日期发送电子邮件。 (访问。)

在特定日期,将需要发送多个通知。(检查)

如何通过在每条可用记录中选择一列信息来发送多封电子邮件来循环记录集?

Set myMail=CreateObject("CDO.Message")
myMail.Subject= (SmsInfo.Fields.Item("Subject").Value)
myMail.From= (SmsInfo.Fields.Item("Email").Value)
myMail.To= mail_to
myMail.HTMLBody= (Tag.Fields.Item("MaintenanceTag1").Value) &     (Agent.Fields.Item("Abreviation").Value) & (Reference.Fields.Item("MaintenanceID").Value) &     "." & (Tag.Fields.Item("MaintenanceTag2").Value) &     (Tag.Fields.Item("MaintenanceTag3").Value) & "."

myMail.Configuration.Fields.Item     ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item("schemas.microsoft/cdo/configuration/smtpserverport") = 25 
myMail.Configuration.Fields.Item("schemas.microsoft/cdo/configuration/smtpserver") = "localhost"
myMail.Configuration.Fields.Item("schemas.microsoft/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
myMail.Configuration.Fields.Item    ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 'basic (clear-text)     authentication 
myMail.Configuration.Fields.Update
myMail.Send

set myMail=nothing

1 个答案:

答案 0 :(得分:1)

需要迭代哪个记录集?看起来您已经有四个:SmsInfoTagReferenceAgent

基本记录集循环如下所示:

Do Until SmsInfo.EOF

    ' Call a SendEmail() routine (not shown) for each record in SmsInfo...
    SendEmail SmsInfo("Subject"), SmsInfo("Email")         

    SmsInfo.MoveNext

Loop