PHP
  Home arrow PHP arrow Page 5 - Creating a Mailing List Manager with PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Creating a Mailing List Manager with PHP
By: Duncan Lamb
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 44
    1999-12-16


    Table of Contents:
  • Creating a Mailing List Manager with PHP
  • Creating the front page
  • Adding names to the list
  • Editing the names
  • Autoresponders
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Creating a Mailing List Manager with PHP - Autoresponders
    ( Page 5 of 6 )


    Autoresponders are mechanisms that automatically email a message to a user when a certain event is completed. Usually, this would be when a new user signs into the list by using a form. To edit the autoresponder, a technique similar to what we used to edit addresses will be used:

    autoresponder.php3

    <html><head><title>Edit Maillist addresses</title></head><body> <form method=post action="writeautoresponder.php3"> <br> This is the automatic message sent to people who submit their name to the Test List mailing list. See Page 5 in the tutorial to see an example of using this feature. <br><br> <textarea cols=70 rows=20 name="Body"> <? readfile("data/autoresponder.txt"); ?> </textarea> <br><br> <input type="submit" name="submit" value="Save This List"></FORM> <br><br><a href="addnames.php3">Add names to a list</a>. <br><br><a href="data/log.txt">View Send Log</a>. <br> </body></html>
    And then the form saves our changes:

    writeautoreponder.php3

    <html><head><title>Updating file....</title></head><body> <br><br> <b>The following autoresponder message has been saved:</b><br> <? $myfile = fopen("data/autoresponder.txt","w"); fputs($myfile,$Body); fclose($myfile); ?> <br> <pre><? echo $Body ?> </pre><br> <br> <a href="index.php3">Home.</a> </body></html>
    To activate it, create a code snipet which will put a small form on any page you choose. Something similar to this would work anywhere:

    <b>Get notified of updates by email:</b><br> <form method="post" action="thanks.php3"> <input type="text" name="Email" size="20"> <input type="submit" Value="Subscribe"></form>
    All that’s left is a processing and Thank You page, which borrows code from the other pages made earlier:

    thanks.php3

    <html><head><title>Thanks!</title></head><body> <? $Body = readfile("data/autoresponder.txt"); mail("$Email","Welcome to my mailing list!", "$Body","From: Me\nReply-To: me@myaddress.com"); $myfile = file("data/mylist.lst"); $fh = fopen("data/mylist.lst","w"); for ($index=0; $index < count($myfile); $index++) { if ($Email != chop($myfile[$index])) {fputs($fh,$myfile[$index]);} } fputs($fh,$Email."\n"); fclose($myfile); ?> Thank you! <br><br> <a href="index.php3">Home</a>. </body></html>
    Note line 4 – it’s a lightly documented trick that allows you to read an entire file into a variable, which is exactly what we need to do here. Of course, if you use this script yourself, it will probably be in another directory, so watch your paths. Also note this is just for one list – what would you need to do to make multiple autoresponders?

    And that’s it! Now your new members will immediately receive a welcome message, or be sent important info, receive a joke of the day, or whatever else you can dream up!

     
     
    >>> More PHP Articles          >>> More By Duncan Lamb
     

       

    PHP ARTICLES

    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek