|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help! JMail coding problem
Hi - I've got the following code that grabs email addys from a ms sql 7 db, but it seems to send 2 emails to everyone on the list - can anyone tell me why, or what I need to do to fix it?
[Code (written in ASP)]: <% On Error Resume Next 'grab the variables from the form strSubject = Request.Form("subject") strBody = Request.Form("body") 'give us 10 minutes for the script to complete running server.scripttimeout = 600000000 'function to open database set DataConn = server.createobject("adodb.connection") ' Create the record set set rs = server.CreateObject("adodb.recordset") ' Open the connection using our ODBC file DSN DataConn.open "DSN" SQL = "execute sp_SendCNewsletter" set rs = DataConn.execute(SQL) WHILE not rs.eof Recipient = rs("EmailAddress") Set objMail = Server.CreateObject("JMail.SMTPMail") objMail.ServerAddress="formmail.strongsecure.com" objMail.Sender = "me@mydomain.com" objMail.Subject = strSubject objMail.AddRecipient Recipient objMail.Body = "Dear "&rs("FirstName")&"," & vbCrLF & vbCrLF & strBody & vbCrLF & vbCrLF & "http://www.mydomain.com - http://www.mydomain.com" & vbCrLF & vbCrLF &vbCrLF & "To remove your email address from this list, please click on the link below." & vbCrLF & "http://mydomain.com?EmailAddress="&rs("idPerson") objMail.Execute rs.movenext WEND Response.write("Newsletter has been Sent") set objMail = nothing rs.close set rs = nothing %> [/code] It connects to the db, sends emails, and writes that the emails have been sent, but it seems everyone gets 2 of them. |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Help! JMail coding problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|