afunguy26 0 Report post Posted October 8, 2009 (edited) remove email from list Simple Newsletter Script <p>hi, remove email script, please ignore previous one...</p><p> </p><p><?php if( isset($_GET['remove']) and $_GET['remove'] == "yes"){ $remove_email = $_GET['email_remove']; $taken_email = array(); $emailfile = file_get_contents("mailing.Txt"); $emaillist = explode("and", $emailfile); foreach ($emaillist as $value) { if ( $remove_email != $value ){ $taken_email[] = $value; } } $value = ""; $file = fopen("mailing.Txt", "w+"); foreach ($taken_email as $value) { if( trim($value) != "" ){ $email = $value; fwrite($file, "and" . $email); } } fclose($file); } ?></p> -reply by majidHi, After I upload the remove email script then what do I do to remove the emails from the mailing.txt? I tried http://example.com/unsubscribe.php?email=example@gmail.com Edited October 8, 2009 by afunguy26 (see edit history) Share this post Link to post Share on other sites
shadowx 0 Report post Posted October 8, 2009 It would have to be site.com/remove.php?remove=yes&email_remove=email@domain.comJudging by the two GET variables.So you can send out a link with the newsletter with a premade HREF tag that plugs in the individual user's email address into the email_remove variable. Need more details please.... Simple Newsletter ScriptHi, I am setting up my first website through Website Tonight and am trying to figure out how to do an e-mail sign-up box for a newsletter. I see your instructions but I guess I don't know what php is, or where to create the files you say to create - is this all done on the website, or in Word, or in some other kind of program? I'm sorry for my stupidity - I am still learning!-question by CarynI would strongly suggest looking for another script to send out newsletters, this isnt super beginner friendly (though its perfectly well made!). If you want to host a reliable site you will need to learn a bit about how the web works and at least touch upon HTML, just to fix little bugs in code etc.... To create a website you need to create code, HTML to be precise, this is done usually in a specific editor, things like Word really arent any good, even though they will tell you they can create websites they really cant and you will run into endless problems. PHP is just another type of code that works in the background. Like the engine of a car, you as a driver never see it, you just give it input (gas, change gears, ignition) and it does some work that you know nothing about, all you know is that the car starts and changes speed. Thats PHP. The bodywork of the car is like HTML, you see it, it holds everything together where the engine (or PHP) does all the heavy work in the background. Share this post Link to post Share on other sites
phpphp 0 Report post Posted October 8, 2009 This tutorial will give you the code needed and tell you how to implement it. First off you need to create a file called mailing.php this will be the file that processes the adding of emails to the list. <?php $email = $_POST['email']; $file = fopen("mailing.txt", "a"); fwrite($file, "\n" . $email); fclose($file); header("Location: mailing_thankyou.php"); ?> Next you need to create a file called mailing_thankyou.php, simple a page thanking them for signing up. Now create a file called mailing.txt with nothing in it, when uploaded to the server set it writable (chmodd 666 or 777). Now you need to form for teh people to enter their email address, put this on any page <form action="mailing.php" method="post" class="style16"> <input type="text" name="email" size="30" value="your email here!"> <input type="submit" value="GO!" name="submit"> </form> Now you need a file to send the newsletter, create a file called anything you want. <?php $send = $_POST['send']; if($send){ $email = $_POST['email']; $emailfile = file_get_contents("mailing.txt"); $emaillist = explode("\n", $emailfile); foreach ($emaillist as $value) { mail($value, $_POST['subject'], $_POST['message'], "From: $email"); } echo "<b>Email sent!</b><br />"; } ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <table width="481" border="0" cellspacing="0" cellpadding="0"> <tr valign="top"> <td width="84" align="right" valign="top" class="style32">Subject:</td> <td width="397" align="left" class="style32"> <input name="subject" type="text" id="subject" size="41" maxlength="100"> </td> </tr> <tr valign="top"> <td width="84" align="right" valign="top" class="style32">From:</td> <td align="left" class="style32"><input name="email" type="text" id="email" size="41" maxlength="100"></td> </tr> <tr valign="top"> <td align="right" valign="top" class="style32">Message:</td> <td align="left" class="style32"> <textarea name="message" cols="37" rows="4" id="message"></textarea> </td> </tr> <tr valign="top"> <td align="right" valign="top" class="style32"> </td> <td align="left" class="style32"> <input name="send" type="submit" id="send" value="SUBMIT"> <input name="Reset" type="reset" id="Reset" value="RESET"> </td> </tr> </table> </form> Thats you all done, to send the newsletter, simply go to the file you just created fill in the spaces, and click send, there is no warning/confirmation. so check before you send! Please note: I will be improving on this script as time goes on, hopefuly to make it able to remove people from the list too, So check back soon! I wanted this script for my website so now I will not have search the sollution it seems simple. Thanks for tutorial... Share this post Link to post Share on other sites
iGuest 3 Report post Posted October 27, 2010 Hi,After I upload the remove email script then what do I do to remove the emails from the mailing.txt? I tried http://example.com/unsubscribe.php?email=example@gmail.com I am also wondering how to remove email with this code. Thanks for the script. I added a wysiwyg editor to this script to send HTML emails. Worked like a charm! Thanks! Share this post Link to post Share on other sites
iGuest 3 Report post Posted September 1, 2011 I am also wondering how to remove email with this code. Thanks for the script. I added a wysiwyg editor to this script to send HTML emails. Worked like a charm! Thanks! Hello can share the script with the wysiwyg editor you added please? Share this post Link to post Share on other sites
annyphp 0 Report post Posted November 5, 2011 Some free php newsletter scripts listed on: http://www.phpnewsletter.org/download.html Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 21, 2012 hello,i was wondering how i can edit textarea? or instead of textarea can i put reguar html code?like "div style="width:500px;backgorund-color:#eee"><a href="#" > click here</a> </div>"instead of textarea i want to style message with link and button..how can i do it?thank you Share this post Link to post Share on other sites
iGuest 3 Report post Posted March 10, 2012 Hello there! Thank you very much for the script, it works perfectly. I only have one issue and maybe it is my fault but if you try to access the txt file by writing the full address (i.e http://www.yourdomain.com/mailing.txt) anyone can see the full list of subscribers... Is there any way to make that hidden or something? Share this post Link to post Share on other sites
iGuest 3 Report post Posted September 13, 2012 Hello there!Thank you very much for the script, it works perfectly. I only have one issue and maybe it is my fault but if you try to access the txt file by writing the full address (i.e http://www.yourdomain.com/mailing.txt) anyone can see the full list of subscribers... Is there any way to make that hidden or something?Add this to your .htaccess:<FilesMatch ".\.txt$">Deny from all</FilesMatch> Share this post Link to post Share on other sites
demonboy1990 0 Report post Posted September 17, 2012 Maybe i will use that code when i can i am going to bookmark this page for later thank you for the code looks great. Share this post Link to post Share on other sites
rpgsearcherz 5 Report post Posted September 17, 2012 Keep in mind that this is just for a single-opt-in it looks like. Most web hosts will require you to use double-opt-in or else you can have your account deactivated due to spam. So before using this on a live server, look into a safer way to build the database of email addresses. Share this post Link to post Share on other sites
demonboy1990 0 Report post Posted September 17, 2012 Thank you. rpgsearcherz i will keep that in mind and if i decide to you it i will test it first. thank you again. Share this post Link to post Share on other sites
rpgsearcherz 5 Report post Posted September 18, 2012 Thank you. rpgsearcherz i will keep that in mind and if i decide to you it i will test it first. thank you again. No problem. I think it would be somewhat easy to adapt for the double-opt-in. All you'd need to do is have it store two new variables for "tempid" or something and "active," in the database. Tempid would be randomly generated and would be what's sent out in a verification email (upon which clicking it would verify the email/id do match), and the active block would tell whether or not it's been verified already. Share this post Link to post Share on other sites
demonboy1990 0 Report post Posted September 24, 2012 rpgsearcherz thank you for the advice i will try that if i decide to use the script. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted September 27, 2012 Hello there! Thank you very much for the script, it works perfectly. I only have one issue and maybe it is my fault but if you try to access the txt file by writing the full address (i.e http://www.yourdomain.com/mailing.txt) anyone can see the full list of subscribers... Is there any way to make that hidden or something? Alternately, move the file outside of the web accessible portion of your account and then reference the file in the script using a "relative" link. Share this post Link to post Share on other sites