<form action = "subscribe.php" method = "post"> <p> Your Email Address: <input type = "text" name = "email"> </p> <p> Action:<br> <select name = "action"> <option value = "subscribe">Subscribe <option value = "unsubscribe">Unsubscribe </select> </p> <input type = "submit" value = "send"> </form>
<? $list_name = "news"; $domain = "your_domain.com"; if ($action == "subscribe") { $email = str_replace("@", "=", $email); $address = $list_name . "-subscribe-" . $email . "@" . $domain; mail($address, "subscribe", "", "From: $email\nReply-To: $email\n"); } if ($action == "unsubscribe") { $email = str_replace("@", "=", $email); $address = $list_name . "-unsubscribe-" . $email . "@" . $domain; mail($address, "subscribe", "", "From: $email\n"); } ?> <head> </head> <body> A confirmation message has been sent to the address you specified. You will need to reply to this message in order to complete this action. </body> </html>
$listname = "news"
Change this to the name of your list
$domain = "your_domain.com";
Change this to your actual domain nameUpload the subscribe.php page to the same directory as the file that has your subscribe form. Visitors to your site will now be able to subscribe and unsubscribe from your website.