File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes autopopulating emails into unsubscibe html forms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "autopopulating emails into unsubscibe html forms" Watch "autopopulating emails into unsubscibe html forms" New topic

autopopulating emails into unsubscibe html forms

Pat Bailey

Joined: Jun 11, 2009
Posts: 1
I am in the process of learning javascripting and need some assistance with autopopulating fields.

I have created several email campaigns which are in html. I then send these out to an email listing with an unsubscribe.html.

I would like to find out what to do to make the responder's email autopopulate into the email field within a form in the unsubscribe html form.

the unsubscribe php looks like this currently:

// get posted data into local variables
$EmailFrom = "";
$EmailTo = "";
$Subject = "Website Contact Form Response";
$Email = Trim(stripslashes($_POST['Email']));
$DescriptionofInquiry = Trim(stripslashes($_POST['DescriptionofInquiry']));

// validation
if (Trim($Email)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";

// prepare email body text
$Body = "";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $Comments;
$Body .= "\n";

// send email
$removal = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to removal page
if ($removal){
print "<meta http-equiv=\"refresh\" content=\"0;URL=removal.html\">";
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";

thanks for any assistance.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

Welcome to the Ranch.

But, please take the time to choose the correct forum for your posts. This forum is for questions on advanced Java. For more information, please read this.

This post has been moved to a more appropriate forum.

[Asking smart questions] [About Bear] [Books by Bear]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
It sounds like the unsubscribe link would need to contain the mail address, and then the PHP page would take parameter and do with it whatever needs doing.

That's insecure, though, because people could unsubscribe anybody from the list who's address they can guess, just by manipulating the link.

The safer way to do this would be to embed something in the URL that's cryptologically secure (like the encrypted address).
I agree. Here's the link:
subject: autopopulating emails into unsubscibe html forms
It's not a secret anymore!