Hi,
I am a newbie for ASP and I am running a simple asp file which retrieves email addresses from the database and collects the result into a string.
Once the string is availbel i am using it to send e-mail using CDO.The program is sending e-mail to everyuser in the string it has collected.everything is ok.But its showing an error page which i don't want to see.the error is CDO.Message.1 (0x8004020C)
At least one recipient is required, but none were found.
This is my program.Please help.
<%@ Language=VBScript %>
<%
str="z687606,z682045,"
str= REplace(trim(str)," ","")
str1=split(str,",")
Dim objConn ' Connection Name
Dim strConn ' Connection String
Dim objRS ' Recordset Variable
Dim strSQL ' variable for SQL statement
Dim intTotalColumns
Dim intCounter
Const adOpenStatic = 3
Const adLockReadOnly = 1
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("users.mdb") & ";"
objConn.Open strConn
dim kk
For i=0 to Ubound(str1)
strSQL = "SELECT Email FROM CRPR_USERS where UNAME='" & str1(i) & "'"
objRS.open strSql, objConn, adOpenStatic, adLockReadOnly
do while not objRS.EOF
kk= kk & objRS("Email") & ","
objRS.MoveNext
loop
objRS.Close
Next
response.write "str is --------" & kk
objConn.Close
Set objConn = Nothing
kk= REplace(trim(kk)," ","")
kk=split(kk,",")
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Const cdoSendUsingPort = 2
For i=0 to Ubound(kk)
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/co...ation/sendusing") = cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item("http://schemas.microsoft.com/cdo/co...tion/smtpserver") = "smtp.mycompany.com"
.Item("http://schemas.microsoft.com/cdo/co...nnectiontimeout") = 10
.Update
End With
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> Campaign Reporting Web Id is activated.Now can subscribe/Download our reports</b></br><br>"
strHTML = strHTML & "Click here to goto the<a href=http://campaignreporting.verizon.com/campaign_reporting/login.html>Login page</a>"
strHTML = strHTML & "<br><h3>This is an automated message.Please do not reply</h3>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"
With iMsg
Set .Configuration = iConf
.To =kk(i)
.From = "
[email protected]"
.Subject = "Testing....pls ignore"
.HTMLBody = strHTML
.Send
End With
Next
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
Response.write "E-mails sent"