JM NewsMail Subscribtion: Version 1.0

News Mail Subscription Form
1 Email adress field - 2 Radio bottuns, Subscribe and Unsubscribe - 1 Submit bottun

GoLive extension by Jesper G.O. Møller
2007 - www.jart.dk/jgom/


Extension Tag Section


Extension Pallet Section

Icon

Thanks for joining."; // subscription messages $message2 = "Your Email has been removed. "; // ***** MAIL INFOMATION ***** $from_email="Your Name "; // yourdomain.com must be your real domain $replayto="name@yourdomain.com"; // replay to email adress // ***************** EMAIL MESSAGES 1 **************************** $mail_subject1="Confermation of your subscribtion to the News Mail"; // subscribe confermation email $mail_message1="Your email has been added to the News Mail list. Thanks for joining. Best regards Your Name --------------------------------------------------------------------- If its not you that have subscribe to the News Mail list Pleas go to http://www.yourdomain.com/ to remove you from the list... "; // ***************** EMAIL MESSAGES 2 **************************** $mail_subject2="Confermation of your removal from the News Mail"; // unsubscribe confermation email $mail_message2="Your email has been removed from the News Mail list. Best regards Your Name ----------------------------------------------------------------- If its not you that have unsubscribe from the News Mail list Pleas go to http://www.yourdomain.com/ to add you to the list... "; // ********************************************************************* // **** DONT EDIT BELOW **** // ********************************************************************* $message = $mainmessage; $email = ""; $formcheck = 0; if (!$_POST){make_form($message); }else{ $email=$_POST["email"]; $email=strtolower($email); $action=$_POST["action"]; if ($email==""){ $message = $mainmessage; $formcheck = 1; }else{ $emailcheck=trim($_POST["email"]); $pattern = "^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$"; if (!eregi($pattern, $emailcheck)){ $message = $errormessage1; $formcheck = 1; }else{ $email_server=substr($email,strpos($email, "@")+1); if (checkdnsrr($email_server)!=1){ $message = $errormessage2; $formcheck = 1; } } } if ($formcheck==0){ if (file_exists($file)){ $file_content=file_get_contents($file); }else{ $cf = fopen($file, "w") or die("Error: file can not be found/create.
Please check folder/path and permissions."); fputs($cf, "News Mail subscribers\n"); fclose($cf); } } if ($formcheck==0){ if ($action=="subc"){ if(strpos($file_content,"<$email>")>0){ $message = $errormessage3; $formcheck = 1; }else{ $cf = fopen($file, "a"); fputs($cf, "\n<$email>"); fclose($cf); mail($email, $mail_subject1, $mail_message1,"From: $from_email\nReply-To: $replayto\nContent-Type: text/plain"); $message = $message1; $formcheck = 1; flush(); } } } if ($formcheck==0){ if ($action=="unsubc"){ if(strpos($file_content,"<$email>")==0){ $message = $errormessage4; $formcheck = 1; }else{ $file_content=preg_replace ("/\n<$email>/","",$file_content); $cf = fopen($file, "w"); fputs($cf, $file_content); fclose($cf); mail($email, $mail_subject2, $mail_message2,"From: $from_email\nReply-To: $replayto\nContent-Type: text/plain"); $message = $message2; $formcheck = 1; flush(); } } } make_form($message); } function make_form($message){ // ********************* News Mail Form ***************************** ?>
Sign up for news
Subscribe Unsubscribe