#!/usr/local/bin/perl -w #EDIT THE ABOVE LINE TO POINT TO PERL ON YOUR SYSTEM # #File: MailListAdmin_basic.pl - Version 3.00 # #Get the current working directory to add to the list of places to search #for the files specified by the "require" statements. $ENV{"PATH_TRANSLATED"} =~ s/\w+\..{1,}$//; push (@INC,$ENV{"PATH_TRANSLATED"}); # # This program was written to support basic mailing-list functionality #without being dependent on an actual email alias for the mailing list. This #increases the portability while also significantly reducing the possibilitiy #of spammers spamming members. # # This particular file will do one of the following depending on the #parameters passed to it: # a is the value for "a" in the query string, which can be any of the following: # 0 - Print the Configurations for the current list # 1 - Print the email form to email a message to members of the current list # 2 - Mail the message to current list # 8 - Print the members of the current list # 9 - View all the currently configured Mailing Lists # #REQUIREMENTS: # 1) Perl Version >= 5.003 OR ActiveState Active Perl Version >= 5.6.1 # 2) You must have an SMTP server running on the machine this script # is installed on. # 3) The CPAN MIME::Base64 Perl Module must be installed (comes with ActivePerl) # 4) The CPAN NET::SMTP Perl Module must be installed (comes with ActivePerl) # 5) The "lozcgi.pl" perl module. It's included as part of the archive and # available from http://www.davelozinski.com/scripts/ # #INSTALLATION: # 1) Set the path to the "require" statements below. If you keep all your files # in the same directory, you most likely will not have to edit the "require" statements. # 2) Set the values located in the "MailListConfigs_basic.pl" # file. ALL VALUES SHOULD BE ENCLOSED IN QUOTES. # 3) Complete the "installation" section of the file "MailList_basic.pl". # #RUNNING: # 1) The URL to address the Admin interface is: # http://www.yourdomain.com/cgi-bin/MailListAdmin_basic.pl?a=9 # #ADDITIONAL FEATURES AVAILABLE IN THE ADVANCED VERSION: # 1) Print the Add form to add an email to the current list # 2) Adding an email to the current list directly, bypassing any # confirmation emails # 3) Removing an email from the current list directly, bypassing any # confirmation emails # 4) Removing several emails from the current list directly, bypassing # any confirmation emails # 5) Displaying the Remove the form to remove an email from the current list # 6) Web interface to update current list settings # 7) Web interface to Create a new list # 8) Web interface to Delete a list # 9) Web interface to Update URLs # 10) Support for MULTIPLE lists # 11) Exporting mail list data to Excel, Word, and a text editor # 12) Sorting member data by email address or date joined # #More details can be found at http://www.davelozinski.com/scripts/ # #WHERE/HOW TO PURCHASE THE ADVANCED VERSION # http://www.davelozinski.com/scripts/ # #LICENSE: # You are free to further develop/modify the source code to fit your #needs, but you MAY NOT resell and/or redistribute the source code in any #way, manner, fashion, or form without my hand-written consent! # # This license grants the purchaser of this archive the permission to #have an unlimited number of users use this script at any time. #Likewise, the purchaser may have any number of copies of this script as long #as the media that this programs is stored on or run from is owned by the purchaser. #If not, more licenses MUST be purchased. #Examples: # 1) If you have your own webserver hosting your various customers, you only need once license #to run the code on your webserver to provide the email functionality to your clients hosted on your server. # 2) If you are designing websites for 3 individual clients, each of which wants the email functionality, #and each of which will be hosting their websites and emailer on their own server, #then you need to purchase 3 licenses. # #If you modify the source code in anyway for your own purposes, the #original header-comments must remain intact. # #REVISION HISTORY: # 3.00 07/31/04 Updated with advanced script. # 2.10 07/04/04 Updated to keep up with "advanced" version. # 2.00 04/12/03 Functionality improved. New features added. # 1.01 06/18/02 Corrected a mailing bug which stopped the program from emailing # every member on the list. # 1.00 03/01/02 Original Version # #CONTACT INFORMATION: # http://www.davelozinski.com/cgi-bin/email_lozinski.pl # use MIME::Base64; use Net::SMTP; use Fcntl ':flock'; # import LOCK_* constants require("lozcgi.pl"); require("MailListConfigs_basic.pl"); ################################ #NOTHING BELOW THIS LINE SHOULD NEED TO BE CONFIGURED ################################ &GetData; $a = defined($in{"a"}) ? $in{"a"} : 9; $e = defined($in{"e"}) ? $in{"e"} : ""; $from = defined($in{"from"}) ? $in{"from"} : ""; $message = defined($in{"message"}) ? $in{"message"} : ""; $subject = defined($in{"subject"}) ? $in{"subject"} : ""; $AnError = 0; $ErrorMessage = ""; $Title = ""; $Admin_Email = ""; $Email_Admin_With_List_Update = 0; $Mail_Subscribe_Thank_You_Letter = 0; $msg_body = ""; $Admin_Script_URL = ""; $Script_URL = ""; $datestring = ""; $mailheaders = ""; $smtp = ""; $localtime = time + (60 * 60); $Title_String = "Mailing List "; if ($a =~ /\d/) { if ($a != 0 && $a !=1 && $a != 2 && $a != 8 && $a != 9) { $a = 9; } } else { $AnError = 1; $ErrorMessage = "
Mail List Administrative Interface __END_OF_HTML_CODE__ print <<__END_OF_HTML_CODE__; | |||||||||||||||||||||
|
__END_OF_HTML_CODE__ #Print the left hand column of buttons. print <<__END_OF_HTML_CODE__; |
__END_OF_HTML_CODE__ if ($a == 0) { #Print the configurations for the current list. print <<__END_OF_HTML_CODE__; __END_OF_HTML_CODE__ } elsif ($a == 1) { #Print the Email form to mail a message to the members. if ((-e $Mail_List_Data_File) && (-s $Mail_List_Data_File) > 0) { print <<__END_OF_HTML_CODE__; Email members of: $Title__END_OF_HTML_CODE__ } else { ###empty member file print ("There are no members currently subscribed to the mail list \"" . $Title . "\".\n"); } } elsif ($a == 2) { #Mail the message to the members on the list. if ($subject eq "") { print ("You need to provide a subject for your email.\n"); } elsif ($from eq "") { print ("You need to specify a \"from\" address for your email.\n"); } else { if ( open (FP,$Mail_List_Data_File) ) { while ($line ="; } $msg_body .= "\n\nYou are receiving this email because you subscribed to: " . $Title . "\n\n"; if ($r_send_html_format) { $msg_body .= " "; } $msg_body .= "\n\n"; if ($smtp = Net::SMTP->new("localhost")) { $smtp->mail("$Admin_Email"); $smtp->to("$email_address"); $smtp->data(); $smtp->datasend("$mailheaders"); $smtp->datasend("\n"); $smtp->datasend("$msg_body\n"); $smtp->dataend(); $smtp->quit(); push (@successes,$email_address); } else { push (@failures,$email_address); } } if (@failures > 0 && @successes > 0) { print ("Click to view members who could not be emailed. \n"); print ("Click to view members successfully emailed \n"); print (" \n"); } if (@failures > 0) { print (" \n"); print (" The following " . @failures . " members were not emailed:\n"); for ($x=0; $x<@failures; $x++) { print ($failures[$x] . "\n"); } } print (" \n"); if (@successes > 0) { print (" Successfully sent an email to these " . @successes . " member(s):\n"); for ($x=0; $x<@successes; $x++) { print ($successes[$x] . "\n"); } } else { print (" No members were successfully emailed.\n"); } } else { print ("Error! Could not open \"" . $Mail_List_Data_File . "\"!\n"); } } } elsif ($a == 8) { #Print the current list of members. if ( -e ($Mail_List_Data_File) && !( -s ($Mail_List_Data_File) == 0)) { if ( open (FP,$Mail_List_Data_File) ) { print <<__END_OF_HTML_CODE__;
An error occurred. The datafile \"". $Mail_List_Data_File . "\" could not be opened for reading.\n"); } } else { print ("The mail list \"" . $Title . "\" currently has no members.\n"); } } elsif ($a == 9) { #View all current lists print <<__END_OF_HTML_CODE__;
|
||||||||||||||||||||