467,122 Members | 1,264 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,122 developers. It's quick & easy.

Unsubscribe link in EMAIL

Hi, I have a database of more than 1000 users. I am sending an email to 50 users at a time using CDO. What i do is get all the email addresses first & then split them into a batch of 50 email addresses & send email batch by batch. That means I send out 20 emails ( with 50 users in each mail). This works PERFECT.
How do I put a Unsubscribe link in my email. I am confused as how to put EMAILADDRESS of each user in my code for unsubscribe??

Expand|Select|Wrap|Line Numbers
  1. IF NOT Upload.Form("toaddr") = "All" Then
  2. rs.open "Select [PrimaryEmail] from [Tbl_Contacts-old] where [OrgCatID] = "&Upload.Form("toaddr")&"", db,3,3
  3. Else
  4. rs.open "Select [PrimaryEmail] from [Tbl_Contacts-old]", db,3,3
  5. End IF
  6.  
  7. toaddr = ""
  8.  
  9. Counter = 0
  10. While not rs.eof
  11. Counter = Counter + 1
  12. If Counter = 50 or Counter = 100 or Counter = 150 or Counter = 200 Then 
  13. toaddr = toaddr & rs("PrimaryEmail") & ";~"
  14. Else
  15. toaddr = toaddr & rs("PrimaryEmail") & "; "
  16. End If
  17. rs.movenext
  18. wend
  19. rs.close
  20. 'response.Write(toaddr)
  21.  'on error resume next
  22. PrimaryEmailAddr=split(toaddr,"~")
  23. maxcounter=ubound(PrimaryEmailAddr)
  24. FOR counter=0 TO maxcounter
  25.    IndEmailAddr=PrimaryEmailAddr(counter)
  26.    response.Write(IndEmailAddr)
  27.    response.Write("<Br>")
  28.  
  29.  Dim oMail, iConf, Flds
  30. Set oMail = Server.CreateObject("CDO.Message")
  31. 'oMail.To   = ""& Upload.Form("toaddr") &""
  32. oMail.Bcc = ""&IndEmailAddr&""
  33. 'oMail.Cc = ""
  34. 'oMail.From   = ""&Upload.Form("fromaddr")&""
  35. oMail.From   = info@mysite.com
  36. oMail.Subject   = ""& Upload.Form("subject") &""
  37. 'oMail.TextBody= ""
  38.  
  39.  
  40.    EmailStr=split(IndEmailAddr,";")
  41.  maxcounter1=ubound(EmailStr)
  42.  FOR counter1=0 TO maxcounter1
  43.      curremail1=EmailStr(counter1)
  44.  
  45.  NEXT 
  46.  
  47. oMail.HTMLBody =  ""&Upload.Form("message")&"" & "<br><p><p><b> To Unsubscribe from the mailing list please<a href=""http://mysite.com/process.asp?email=" & curremail1 & "&cancel=yes""> CLICK HERE</a>.</B>" &_
  48.                 "<br /><br> Best Regards,<br>Admin Team."
  49.  
  50. oMail.Send
  51. Set oMail = Nothing
  52.  
  53. NEXT
  54.  
  55.  
Feb 4 '09 #1
  • viewed: 5040
Share:
3 Replies
By unsubscribe I mean providing a link in the email I sent. & once the user clicks on the link his email is automatically removed from the DB. the problem is how do I write user email address in the link:?? Since in my variable "IndEmailAddr" I have 50 email addresses, I know how to split them but how do i write them individually in each mail, which is sent out?

Expand|Select|Wrap|Line Numbers
  1. oMail.HTMLBody =  " To Unsubscribe from the mailing list please<a href=""http://mysite.com/process.asp?email=" & curremail1 & "&cancel=yes""> CLICK HERE</a>.</B>" &_              
Feb 4 '09 #2
jhardman
Expert 2GB
You could change the link to say "To unsubscribe, send your email address as the subject line to 'unsubscribe@mySite.com'" or "Click here to unsubscribe" and send them to a site where they enter their email address. I know, it's less elegant than an individualized response, but I see that type of solution fairly often.

Jared
Feb 4 '09 #3
Thxs Jared, yeh this I can do, but was trying to find a way where the user just click on UNSUBSCRIBE link & gets deleted automatically.
Feb 4 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Faust, Chris | last post: by
4 posts views Thread by zsh-users-help@sunsite.dk | last post: by
7 posts views Thread by Angelos | last post: by
reply views Thread by Nitish Korla | last post: by
7 posts views Thread by Alex | last post: by
12 posts views Thread by Edmund Dengler | last post: by
1 post views Thread by Lampa Dario | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.