Unsubscribing Email is easy if you are already maintaining the users email id's in Database.
Previously post i was explained about the How to remove rows from GridView using jQuery in asp.net,
Nested GridView in ASP.NET Using c# with show/hide .How to Add a Locked Header Row to an ASP.NET GridView Control
Step 1: Create an extra column in user table as unsubscribe in database. it will take true or false values and set default as false so that every subscribed user gets email.
Note : Before sending Mails to users please check their unsubscribe column. if it is false send an Email. if it is true don't send an Email as they have unsubscribed.
Step2: Create an unsubscribing URL as below:
http://mywebsite.com/unsubscribeme/emailID=xyz@gmail.com
Step3: Send this URL to user as unsubscribe URL so that whenever he feels to unsubscribe he can do that simply by clicking on that URL.
Step4: once if user clicks on given URL read the QueryString value of emailID emailID=xyz@gmail.com
Step5: Update the user table info by setting the unsubscribe column value to true.
Example :
//get user EmailID by QueryString as below:
String EmailID=Reques.QueryString["emailID"].ToString();
//Update the usertable as below:
String Command ="update usertable set unsubscribe='true' where emailid='"+EmailID+"'
Most email clients only support mailto-links.
Try this, it should work always:
So this does not always work:
Try this, it should work always:
mailMessage.Headers.Add("List-Unsubscribe", "<mailto:list@host.com?subject=unsubscribe>");
The RFC specifies it is possible to use http-links also.
But i've found that if you include http-links, the email clients no
longer shows the unsubscribe link. I think it's because of the
possibility that people only have access to the mail protocol.So this does not always work:
mailMessage.Headers.Add("List-Unsubscribe", "<http://www.host.com/list.cgi?cmd=unsub&lst=list>, <mailto:list-request@host.com?subject=unsubscribe>";
Related Posts :
http://www.dotnetspark.com/kb/337-subscribe-and-unsubscribe-asp-net.aspx
Comments
Post a Comment