Email with embedded link to capture email address?

Much like most newsletters, I'd like to include a link in an email that, when clicked on, links the user to a webpage and captures their email address (think unsubscribe link).

Ideally, I'd be able to do this in a standard HTML email, with no 3rd party software.

Who is Participating?
Dustin HopkinsConnect With a Mentor Managing MemberCommented:
use quesrystring variables. When sending out the email, just code the hyperlink with the email as a querystring var and then when the page loads capture the email from the querystring.
So your hyperlink would look like this in html.
In this case "mail" is the variable that contains the email address.
<a href="">Unsubscribe Here</a>

Then in the page_load of the page it links to, use something like this.
Dim email as strin = "None Provided"
if not Request.QueryString("mail") is nothing then
email = Request.QueryString("mail")
end if
Dustin HopkinsManaging MemberCommented:
You can also get the querystring variables using javascript, using a function like this.

<script>function getQueryVariable(variable) {  var query =;  var vars = query.split("&");  for (var i=0;i<vars.length;i++) {    var pair = vars[i].split("=");    if (pair[0] == variable) {      return pair[1];    }  }   alert('Query Variable ' + variable + ' not found');}</script>Now make a request to page.html?x=Hello<script>  alert( getQueryVariable("x") );</script>

Open in new window

dday515Author Commented:
The query string idea works if I send a single email to each user (which is one possible solution, but not ideally what I'd LIKE to do.).

Ideally, I'd like to code a webpage that could be sent to multiples and uses dynamic code to capture the email address. So when person1 clicks on the link, it captures that its , whereas when person2 clicks, it captures

That may be a pipe dream, and may not be possible at all.
Dustin HopkinsManaging MemberCommented:
Ok, let me see if I have this right. you want to code the page to be sent(html email) such as the ones you get from experts exchange? a lot of your code will be generated on the fly like below. Most of teh contnet will be pulled from your database. If this isn't what you're looking for lemme know.


dim email as string = ""
dim htmlemail as string = "<HTML><H1>WElcome to my newsletter</H1>"
htmlemail += "<h3>To unsubcribe click <a href="" & emailaddr & ">Here</a></h3>"
'send htmlemail

Open in new window

Forced accept.

EE Admin
All Courses

From novice to tech pro — start learning today.