I am trying to loop through a dataset for email address's and send an email...but I am getting three emails to the one address........
Please can anyone offer me any assistance...I am really tired and want to got to bed1...adn I have tried......as you can see
any help much appreciated
kind regrads
Tony
msg.Subject = "xxxxx xxxxx ~ Has Updated Their Information"
msg.body = TheMessage
msg.From = "info@dotnet.itags.org.me.co.uk"
SmtpMail.SmtpServer="www4.mysmtp.co.uk"
for I = 0 to DSlogin.tables("UserInfo").rows.count - 1
msg.To = DSlogin.tables("UserInfo").rows(0).item("EmailAddress")
SmtpMail.Send(msg)
next Ichange row(0) to row(I)
msg.To = DSlogin.tables("UserInfo").rows(I).item("EmailAddress")
also,very important!!!
you have to clear all the recipients at the end of the loop (after smtpmail.send), otherwise, you'll end up sending to the row0 address three times.
Hi and thanks
did this
msg.To = DSlogin.tables("UserInfo").rows(I).item("EmailAddress")
SmtpMail.Send(msg)
msg.To =""
counta = counta + 1
next
...didnt seem to work
i apologize for mis-leading.
msg.To is a string value, it will not append to the original address like Persist mailer does, it simply replaces the original address.
i can't tell what's wrong from the code you posted, try replacing smtpmail.send with response.write(msg.to), see what values you get.
it's also weird that in C#, datarow does not have item attribute, but vb.net does
i am not sure if the following two are equivalent:
msg.To = DSlogin.tables("UserInfo").rows(I)("EmailAddress")
msg.To = DSlogin.tables("UserInfo").rows(I).item("EmailAddress")
Perhaps your SQL statement is returning more than one record per individual.
0 comments:
Post a Comment