Unsubscribe link in EMAIL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kashif73
    New Member
    • Sep 2008
    • 91

    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??

    Code:
    IF NOT Upload.Form("toaddr") = "All" Then
    rs.open "Select [PrimaryEmail] from [Tbl_Contacts-old] where [OrgCatID] = "&Upload.Form("toaddr")&"", db,3,3
    Else
    rs.open "Select [PrimaryEmail] from [Tbl_Contacts-old]", db,3,3
    End IF
     
    toaddr = ""
     
    Counter = 0
    While not rs.eof
    Counter = Counter + 1
    If Counter = 50 or Counter = 100 or Counter = 150 or Counter = 200 Then 
    toaddr = toaddr & rs("PrimaryEmail") & ";~"
    Else
    toaddr = toaddr & rs("PrimaryEmail") & "; "
    End If
    rs.movenext
    wend
    rs.close
    'response.Write(toaddr)
     'on error resume next
    PrimaryEmailAddr=split(toaddr,"~")
    maxcounter=ubound(PrimaryEmailAddr)
    FOR counter=0 TO maxcounter
       IndEmailAddr=PrimaryEmailAddr(counter)
       response.Write(IndEmailAddr)
       response.Write("<Br>")
     
     Dim oMail, iConf, Flds
    Set oMail = Server.CreateObject("CDO.Message")
    'oMail.To   = ""& Upload.Form("toaddr") &""
    oMail.Bcc = ""&IndEmailAddr&""
    'oMail.Cc = ""
    'oMail.From   = ""&Upload.Form("fromaddr")&""
    oMail.From   = [EMAIL="info@mysite.com"]info@mysite.com[/EMAIL]
    oMail.Subject   = ""& Upload.Form("subject") &""
    'oMail.TextBody= ""
     
     
       EmailStr=split(IndEmailAddr,";")
     maxcounter1=ubound(EmailStr)
     FOR counter1=0 TO maxcounter1
         curremail1=EmailStr(counter1)
     
     NEXT 
     
    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>" &_
                    "<br /><br> Best Regards,<br>Admin Team."
     
    oMail.Send
    Set oMail = Nothing
     
    NEXT
  • kashif73
    New Member
    • Sep 2008
    • 91

    #2
    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 "IndEmailAd dr" 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?

    Code:
    oMail.HTMLBody =  " To Unsubscribe from the mailing list please<a href=""http://mysite.com/process.asp?email=" & curremail1 & "&cancel=yes""> CLICK HERE</a>.</B>" &_

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      You could change the link to say "To unsubscribe, send your email address as the subject line to 'unsubscribe@my Site.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

      Comment

      • kashif73
        New Member
        • Sep 2008
        • 91

        #4
        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.

        Comment

        Working...