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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dustin HopkinsSenior Web DeveloperCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dustin HopkinsSenior Web DeveloperCommented:
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 HopkinsSenior Web DeveloperCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.