Reputation: 386
I am working on a website with Asp.Net (C#) and I have a problem like this:
I will sent an email for 20 person and there is a link in mail. If user click the link I want to save somewhere (database, text file etc.) this user mail address.
How can I do?
Thanks,
John
Upvotes: 1
Views: 1471
Reputation: 322
I do not think it's possible to retrieve email address from http headers, because I think the email applications do not include the user email address in the http request.
The only possible way I can think of doing this is including the email address where you sent the message in the database and specific key alongside of the email address. Then you send this specific key as a get variable in the url to the users you want and when they click the link compare the get variable against the database and retrieve the email address of the user who clicked the link.
Upvotes: 0
Reputation: 33139
You will have to link to an ASPX page and embed the email address of the user in that link, encoded in the URL.
For instance, you can send your mail to user [email protected]
a link like this:
<A HREF="[email protected]">Click here</A>
Then your linkup.aspx
page can easily read the input parameter and save the data anywhere it wants.
Upvotes: 1
Reputation: 1038780
Since you already know the email address of the person (because you sent an email to him), you could include a query string parameter to the anchor that is part of the mail message:
<a href="http://example.com/foo.aspx?email=john.smith%40foo.com">Click me</a>
When the person viewing this mail clicks on the link the foo.aspx
page on your site will be called and passed the email. From there on you could do whatever you want with this email (save it in a database, text file, whatever you want).
For obvious reasons you might want to encrypt this email address to avoid him changing it and passing some other address. Depending on the level of security you require and the sensibility of changing this email there are different encryption algorithms you could use.
Upvotes: 4