#!/usr/bin/perl use strict; # try this, if you can -> /usr/libdata/perl5 # WinNT users! You may want to change the first line of this script to: #!C:/perl/bin/perl.exe # Note: KEEP the '#' character as the first character of that line. # WinNT users! If you're getting warnings in your browser, uncomment # this line: #close STDERR; #!/usr/bin/perl # use CGI::Carp "fatalsToBrowser"; # The line above, when uncommented, gets any server errors created # by Mojo Mail and shows them to your web browser. This facilitates # debugging, but it can be annoying if you really don't want this happening. # You'll see something in your browser that says 'Software Error' in big # old letters and then what the error was. Having this on also makes the # # What is in this script that you may want to at least look over are things # that may have to be tweak to fit your server configuration. # 99% of you won't ever have to change this, but then again, you might be # that 1%, so I'll try to walk you through. # First off, if you simply cannot get this script to work, and none of your # error logs point to something that's easy to pick out, try to change the # first line to something else. Its set at: # # #!/usr/bin/perl -w # # as a default. This might not be correct. Other things you can try are: # # # #!/usr/local/bin/perl -w # #!/usr/bin/perl5 -w # #!/usr/local/bin/perl5 -w # # For WinNT folk, you may want to try: # #!C:/perl/bin/perl.exe # # # If you don't know, this is called the 'path to Perl' This script needs to know # where it is, and if you don't know it, it can't figure it out by itself. You may # also need to change this if you're attempting to run mojo on a Windows NT server, # ask whoever is in charge of your web hosting server. # Another tid bit that I'll share is the -w at the end of that little line. That's called # the 'warning' flag and, well warns you of stuff that might not be correct. Its nice # to have to figure out weird errors. It also produces a lot of # # Use of uninitialized value at .. blah blah blah blah # # Which you may find annoying and also filling up your error logs with gobble dee gook # take the -w flag of like this # #!/usr/bin/perl # # and most of those warnings will stop. use lib qw(./ ./MOJO ./MOJO/perllib); # in weird server setups, you may need to change this to the absolute path # to the mojo folder, something like: # # /usr/home/account/www/cgi-bin/mojo # # If you move the MOJO directory, you'll need to change the # # use lib './'; # # to where it is really located. again, if you're running this on a windows # server, you may have to change this to the full path anyways. $ENV{PATH} = "/bin:/usr/bin"; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; # If you'd like, you can set a $ENV{PATH} for this program. This is in the ongoing # effort to allow Mojo Mail to run in 'Taint' mode. If you don't know what that means, # don't worry. Mojo Mail doesn't in the least bit need to run in taint mode. use MOJO::Config; use MOJO::App::Guts; use MOJO::Template::HTML; use MOJO::MailingList::Subscribers; # The three lines above load in needed modules, other modules are loaded # dynamically, but these three are needed almost all of the time. ###################################################################### # After popular opinion (aka enough people decided I should do this) # I now allow you to set the size, shape and characteristics of the # "Send a List Message' Form. I don't feel like having these variables in the # Config.pm file, since they're just used for this script, but here goes: # width of the textarea my $cols = 70; # height of the textarea my $rows = 15; # wrap my $wrap = 'NONE'; # style my $text_area_style = 'font-size:11px'; # check out: # http://www.eskimo.com/%7Ebloo/indexdot/html/tagpages/t/textarea.htm # for the skinny on what these really do, if you don't know ###################################################################### ###################################################################### # ! The variables you need to change are located in the Config.pm # file that is itself located in the MOJO folder. ###################################################################### ###################################################################### # Mojo Mail. An Easy And Powerful List Management System # # By Justin Simoni <+> justin@skazat.com <+> http://skazat.com # copyright 1999 - 2003 # # This program is Open Source Software and is covered under the General # Public License. You should have gotten a copy of the license with this script. # if not, you can view a copy at: http://www.gnu.org/copyleft/gpl.html # # Mojo Mail is free(!) software. Free as in speech, not in as beer or price, # please make sure you understand this. # # I do ask that you also PLEASE keep the link back to the support site intact, # the link that says: # List Management by Mojo Mail 2 <+> http://mojo.skazat.com # throughout the script, and also keep this header intact as well # # This enables people to find the program and use it themselves. # If you want it removed, you can give a $50 donation, # and I will allow you to take off the link, you can send check or money to: # # Justin Simoni # PO Box 369 # Boulder, CO # 80306 # # All money will go to support the program, the Mojo Mail website # and keeping an exceptionally bright student in college and beyond. # # Changes, Enhancements, Modifications and Professional Installation # of this script can be made on a project by project basis, # please contact: Skazat Designs at design@skazat.com # (the developer of Mojo Mail) if you are interested. ##################################################################### # This is the rest of the program, feel free to tweak as needed, if you # find some great enhancement, share it with the community! ###################################################################### # Use the CGI.pm module, to facilitate web page generation and get cookie functions use CGI; CGI->nph(1) if $NPH == 1; # Use strict to make code cleaner, and more safely written use strict; # Unbuffer output for faster page displaying $|++; #Ok, here we go... :) ###################################################################### my $q = new CGI; $q->charset($HTML_CHARSET); my $flavor = $q->param('flavor'); $flavor = $q->param('f') unless($flavor); #$flavor = 'default' if(!$flavor); my $process = $q->param('process'); my $email = $q->param('email') || ""; $email = $q->param('e') || "" unless($email); my $list = $q->param('list'); $list = $q->param('l') unless($list); my $list_name = $q->param('list_name'); my $pin = $q->param('pin'); $pin = $q->param('p') unless($pin); my $admin_email = $q->param('admin_email'); my $mojo_email = $q->param('mojo_email'); my $info = $q->param('info'); my $private_policy = $q->param('private_policy'); my $privacy_policy = $q->param('privacy_policy'); my $password = $q->param('password'); my $retype_password = $q->param('retype_password'); my $keyword = $q->param('keyword'); my @address = $q->param('address'); my $done = $q->param('done'); my $id = $q->param('id'); my $quick = $q->param('quick') || 'no'; my $advanced = $q->param('advanced') || 'no'; my $help = $q->param('help'); $list = xss_filter($list); $flavor = xss_filter($flavor); $email = xss_filter($email); $pin = xss_filter($pin); $keyword = xss_filter($keyword); ############################################# #Retrieve the cookie. all the info is saved # #on a seperate cookie for each list. # #logging out erases the password # ############################################# my %logincookie = $q->cookie($LOGIN_COOKIE_NAME); my $admin_list = $logincookie{admin_list}; my $admin_password = $logincookie{admin_password}; #external (mostly..) functions called from the web browser) # a few things mojo can do.... :) my %Mode = ( 'default' => \&default, #user start page with all lists 'subscribe' => \&subscribe, #user sends conformation 'subscribe_flash_xml' => \&subscribe_flash_xml, 'new' => \&confirm, #user adds email 'unsubscribe' => \&unsubscribe, #user unsunbscribes 'admin' => \&admin, #admin login in to the admin area 'login' => \&login, #admin check the user/pass 'logout' => \&logout, #admin erase user/pass 'new_list' => \&new_list, #admin make a new list 'change_info' => \&change_info, #admin change the info in the .db file 'html_code' => \&html_code, #admin get cut + paste code 'admin_help' => \&admin_help, #admin help page 'delete_list' => \&delete_list, #admin delete the list 'list_stats' => \&list_stats, 'view_list' => \&view_list, 'view_list_options' => \&view_list_options, 'edit_subscriber' => \&edit_subscriber, 'add' => \&add, #admin add emails 'email_password' => \&email_password, #admin email the password to the admin 'add_email' => \&add_email, #admin admin add an email 'delete_email' => \&delete_email, #admin admin delete an email 'send_email' => \&send_email, #admin send the list email 'preview_form' => \&preview_form, #admin preview the form 'checker' => \&checker, #admin mass delte email 'edit_template' => \&edit_template, #admin edit the template 'view_archive' => \&view_archive, #admin 'edit_archive' => \&edit_archive, 'delete_archive' => \&delete_archive, 'archive' => \&archive, #user look at list the archive 'chocolate' => \&chocolate, #chocolate! 'all_list_code' => \&all_list_code, #user, shows signup code for all lists. 'manage_script' => \&manage_script, #admin get info on the script 'change_password' => \&change_password, #change your password 'text_list' => \&text_list, #admin shows email list in new window 'send_list_to_admin' => \&send_list_to_admin, #admin sends email list to adin 'search_email' => \&search_email, #admin search through emails 'archive_options' => \&archive_options, #admin archive options 'adv_archive_options' => \&adv_archive_options, #admin archive options 'back_link' => \&back_link, #create a back button 'edit_type' => \&edit_type, #customize type and stuff 'edit_html_type' => \&edit_html_type, #customize type and stuff 'list_options' => \&list_options, # customize list options 'sending_options' => \&sending_options, # customize sending options 'adv_sending_options' => \&adv_sending_options, # adv sending options 'sign_in' => \&sign_in, # sign into individual lists 'black_list' => \&black_list, #sign into black lists 'search_archive' => \&search_archive, # search through the archive (user) 'send_archive' => \&send_archive, # send a copy of an archive message 'mojo_send_options' => \&mojo_send_options, # options for mojo_send.pl 'list_invite' => \&list_invite, # invite a whole bunch of people to your list 'pass_gen' => \&pass_gen, # password generation 'send_url_email' => \&send_url_email, 'feature_set' => \&feature_set, 'smtp_options' => \&smtp_options, 'checkpop' => \&checkpop, 'author' => \&author, 'list' => \&list_page, 'setup_info' => \&setup_info, 'reset_cipher_keys' => \&reset_cipher_keys, 'r' => \&redirection, # these params are the same as above, but are smaller in actual size # this comes into play when you have to create a url usign these as parts of it. 's' => \&subscribe, # subscribe 'n' => \&confirm, # confirm the subscription 'u' => \&unsubscribe, # unsubscribes ); &_chk_env_sys_blk(); # the BIG switcheroo. Mark doesn't like this :) if(exists($Mode{$flavor})) { $Mode{$flavor}->(); #call the correct subroutine }else{ &default; } sub default { user_error(-Error => 'bad_setup') if(check_setup() == 0); my @available_lists = available_lists(-In_Order => 1); my @available_archives = available_archives(); my %default_list; my $default_exists = check_if_list_exists(-List=>$DEFAULT_LIST,); if($DEFAULT_LIST ne "" && $default_exists >= 1){ %default_list = open_database(-List =>$DEFAULT_LIST); } #print header(); print(the_html(-Part => "header", -Title => "Sign up for a list", -List => $DEFAULT_LIST)); if ($available_lists[0]) { print qq{
|
Choose a list: |
Enter your email address: |
| }; require MOJO::Template::Widgets; print MOJO::Template::Widgets::list_popup_menu(); print qq{ | |
|
Subscribe | Unsubscribe |
|
Available Lists:}; foreach my $everything(@available_lists){ my %all_list_info = open_database(-List => $everything); if($all_list_info{hide_list} ne "1"){ print"$all_list_info{list_name} /gio;
$all_list_info{info} =~ s/\n/ | |
Please agree to the terms of the GPL License and the No SPAM policy by checking the checkbox below:
} if $agree eq 'no'; my $gpl = MOJO::App::Licenses::gpl(); my $no_spam = MOJO::App::Licenses::no_spam(); print qq{You installed $PROGRAM_NAME correctly, the next thing to do is set up a list or two. Be sure you know your root password and enter it below to begin making a new list:
Please Read, Understand and Agree to the GNU Public License as well as agreeing not to use Mojo Mail for unsolicited (SPAM) email.
$no_agree
I agree to the GPL license and no-spam conditions
Root Password: /g;
$list_info{$_}=~ s/\n/ $bullet $archive_links[$ii]\n";
#}
#}
}
print ' You will need to know your List Password to access your control panel Select your list: Type in your List Password
};
require MOJO::Template::Widgets;
print MOJO::Template::Widgets::list_popup_menu(-name => 'admin_list',
-show_hidden => 1);
print qq{
/g;
}
print $q->h3('About ' . $list_info{list_name} . ':') . $q->p($list_info{info});
print $q->hr();
print $q->h3('Privacy Policy:') . $q->p($list_info{private_policy}) . $q->hr() if($list_info{private_policy});
if ($list_info{show_archives} ne "0"){
require MOJO::MailingList::Archives;
my $archive = MOJO::MailingList::Archives->new(-List => \%list_info);
my $entries = $archive->get_archive_entries();
print $q->h3("Archives:") if defined($entries->[0]);
my @archive_nums;
my @archive_links;
my $stopped_at;
my ($begin, $stop) = $archive->create_index(0);
my $i = 0;
my $num = 1;
for($i = $begin; $i <=$stop; $i++){
my $link;
if(defined($entries->[$i])){
my ($subject, $message, $format) = $archive->get_archive_info($entries->[$i]);
my $pretty_subject = pretty($subject);
$link.= " [$i]&list=$list\">$pretty_subject
";
my $date = date_this(-Packed_Date => $entries->[$i],
-Write_Month => $list_info{archive_show_month},
-Write_Day => $list_info{archive_show_day},
-Write_Year => $list_info{archive_show_year},
-Write_H_And_M => $list_info{archive_show_hour_and_minute},
-Write_Second => $list_info{archive_show_second});
$link .= "Sent $date \n";
$link .= "';
for($ii=0;$ii<=$#archive_links; $ii++){
my $bullet = $archive_nums[$ii];
#fix if we're doing reverse chronologic
$bullet = (($#{$entries}+1) - ($archive_nums[$ii]) +1) if($list_info{sort_archives_in_reverse} eq "1");
print "
';
print $archive->create_index_nav($list_info{list}, $stopped_at);
print $archive->make_search_form($list_info{list}) if($list_info{archive_search_form} eq "1");
print $q->hr() if defined($entries->[0]);
}
print "" if $SHOW_ADMIN_LINK ==1;
print(the_html(-Part => "footer", -List => $list));
}
sub admin {
my @available_lists = available_lists();
my %default_list;
my $default_exists = check_if_list_exists(-List=>$DEFAULT_LIST,);
if($DEFAULT_LIST ne "" && $default_exists >= 1){
%default_list = open_database(-List =>$DEFAULT_LIST);
}
#print header();
print(the_html(-Part => "header",
-Title => "Administration",
-List => $DEFAULT_LIST));
print $q->end_form();
print $q->start_form(-action => $S_MOJO_URL, -method => 'Post');
print qq{
Enter Your List Control Panel
Select your list:
" if($list_exists < 1); print <Type in your List Password
EOF ; if($list_exists < 1){ require MOJO::Template::Widgets; print MOJO::Template::Widgets::list_popup_menu(-name => 'admin_list', -show_hidden => 1); }else{ print ""; print "
"; } print <
|
|
Warning! No SMTP Server has been set!
" if((!$list_info{smtp_server}) && ($list_info{send_via_smtp} eq "1")); # we give a link to the basic screen if we be in advanced # and vice versa. if($advanced eq 'yes'){ print $q->p({-align=>'right'}, $q->a({-href=>"$S_MOJO_URL?flavor=$flavor"},'Basic...')); }else{ print $q->p({-align=>'right'}, $q->a({-href=>"$S_MOJO_URL?flavor=$flavor&advanced=yes"},'Advanced...')); } # start the new form print $q->start_multipart_form(-action=>$S_MOJO_URL, -method=>'POST', -name=>'the_form'), $q->hidden('list',$list_info{list}), $q->hidden(-name => 'flavor', -value => 'send_email', -override =>1); # remember its advanced if we have to. print $q->hidden('advanced', $advanced) if($advanced eq 'yes'); # this basically is the widget to say 'is this text or html?' my $format_options = <EOF ; # end that, wasn't so bad eh? print $q->end_form(); print(admin_html_footer(-List => $list)); }else{ # pull in the Mime::Lite module require MIME::Lite; MIME::Lite->quiet(1) if $MIME_HUSH == 1; ### I know what I'm doing $MIME::Lite::PARANOID = $MIME_PARANOID; my $email_format = $q->param('email_format') || undef; # get the message subject my $message_subject = $q->param('message_subject'); # get the text message my $text_message_body = $q->param('text_message_body') || undef; # if one was passed, if($text_message_body){ # get rid of weird line breaks caused by textareas $text_message_body =~ s/\r\n/\n/g; # get some saved formatting stuff my $text_template = $list_info{mailing_list_message}; # format $text_template =~ s/\[message_body\]/$text_message_body/g; # switch it back $text_message_body = $text_template; # interpolate [tags] to $tags $text_message_body = interpolate_string(-String => $text_message_body, -List_Db_Ref => \%list_info); } # get the HTML message (if any) my $html_message_body; $html_message_body = $q->param('html_message_body') || undef; if(($email_format eq 'HTML') || ($email_format eq 'HTML_and_text')){ $html_message_body = $q->param('text_message_body') || undef; }else{ $html_message_body = $q->param('html_message_body') || undef; } my $html_archive_message_body; if($html_message_body){ # get rid of weird line breaks $html_message_body =~ s/\r\n/\n/g; # get some saved template my $html_template = $list_info{mailing_list_message_html}; # template it $html_template =~ s/\[message_body\]/$html_message_body/g; # switch it back $html_message_body = $html_template; # interpolate [pusedo tags] $html_message_body = interpolate_string(-String => $html_message_body, -List_Db_Ref => \%list_info); } # escape the list name for query strings. # see if we gots an attachment my $attachment = $q -> param('attachment'); my $s_link = subscribe_link(-list => $list, -email => '[email]', -pin => '[pin]'); my $us_link = unsubscribe_link(-list => $list, -email => '[email]', -pin => '[pin]'); my $html_unsubscribe_link = "$us_link"; my $html_subscribe_link = "$s_link"; # make sub links my $text_unsubscribe_link = $us_link; my $text_subscribe_link = $s_link; my $message_id = message_id(); my $content_type; if($advanced){ # do some advanced stuff. if(defined($text_message_body) ne ""){ # interpolate the sub and unsub links $text_message_body =~ s/\[list_unsubscribe_link\]/$text_unsubscribe_link/g; $text_message_body =~ s/\[list_subscribe_link\]/$text_subscribe_link/g; } if(defined($html_message_body) ne ""){ # interpolate the sub and unsub links $html_message_body =~ s/\[list_unsubscribe_link\]/$html_unsubscribe_link/g; $html_message_body =~ s/\[list_subscribe_link\]/$html_subscribe_link/g; } } if($email_format){ # if we got here, we're using the 'basic' screen if($email_format eq "TEXT"){ # if we have text, treat it as so. $content_type = 'text/plain'; $text_message_body =~ s/\[list_unsubscribe_link\]/$text_unsubscribe_link/g; $text_message_body =~ s/\[list_subscribe_link\]/$text_subscribe_link/g; }elsif($email_format eq "convert_to_plain_text"){ # do our best to strip HTML taghs $content_type = 'text/plain'; $text_message_body = convert_to_ascii($text_message_body); $text_message_body =~ s/\[list_unsubscribe_link\]/$text_unsubscribe_link/g; $text_message_body =~ s/\[list_subscribe_link\]/$text_subscribe_link/g; }elsif($email_format eq 'HTML'){ # its HTML! $content_type = 'text/html'; $html_message_body = $html_message_body; undef($text_message_body); $html_message_body =~ s/\[list_unsubscribe_link\]/
$html_unsubscribe_link/g; $html_message_body =~ s/\[list_subscribe_link\]/
$html_subscribe_link/g; }elsif($email_format eq 'HTML_and_text'){ # make two versions of the message, the other one being converted html to text $content_type = 'multipart/alternative'; $html_message_body = $html_message_body; $html_message_body =~ s/\[list_unsubscribe_link\]/
$html_unsubscribe_link/g; $html_message_body =~ s/\[list_subscribe_link\]/
$html_subscribe_link/g; $text_message_body = convert_to_ascii($text_message_body); $text_message_body =~ s/\[list_unsubscribe_link\]/$text_unsubscribe_link/g; $text_message_body =~ s/\[list_subscribe_link\]/$text_subscribe_link/g; } } if($html_message_body){ if($q->param('apply_template') == 1){ $html_archive_message_body = $html_message_body; $html_message_body = (the_html(-Part => "header", -Title => $message_subject, -List => $list, -Header => 0)) . $html_message_body . the_html(-Part => "footer", -List => $list); } } my $msg; my $plain_msg; my $fancy_msg; if($text_message_body and $html_message_body){ # if we have text and html, we need to make a multipart/alternative message, #$msg = MIME::Lite->new(Type => 'multipart/alternative'); $msg = MIME::Lite->new(Type => 'multipart/alternative'); $plain_msg = $msg->attach(Type => 'text/plain', Data => $text_message_body, Encoding => $PLAIN_TEXT_ENCODING); if($q->param('html_with_images') == 1){ $fancy_msg = $msg->attach(Type => 'multipart/related'); $fancy_msg->attach(Type => 'text/html', Data => $html_message_body); }else{ $msg->attach(Type => 'text/html', Data => $html_message_body); } }elsif($text_message_body){ if(!$q->param('attachment_1')){ # make only a text body $msg = MIME::Lite->new(Type => 'TEXT', Data => $text_message_body, Encoding => $PLAIN_TEXT_ENCODING); }else{ $msg = MIME::Lite->new(Type => 'TEXT', Data => $text_message_body); } }elsif($html_message_body){ # make only a html body if($q->param('html_with_images') == 1){ $msg = MIME::Lite->new(Type => 'multipart/alternative'); $plain_msg = $msg->attach(Type => 'text/plain', Data => ' '); $fancy_msg = $msg->attach(Type => 'multipart/related'); $fancy_msg->attach(Type => 'text/html', Data => $html_message_body); }else{ $msg = MIME::Lite->new(Type => 'text/html', Data => $html_message_body); } }else{ # else, we probably have an email with only attachments. $msg = MIME::Lite->new(Type =>'multipart/mixed'); } my $attach_report; #if we have attachments... my @attachments; if($attachment){ my $ii; $attach_report = "
Attachments:
";
# for those attachments
for($ii = 1; $ii <= $at_num; $ii++){
my $a_type;
my $this_attachment = "attachment_$ii";
# get it by garment,
my $get_attachment = $q->param($this_attachment);
if($get_attachment){
my $attach_name = $get_attachment;
$attach_name =~ s!^.*(\\|\/)!!;
my $file_ending = $attach_name;
$file_ending =~ s/.*\.//;
# This should work, since I'm bloody shipping the program
# with em'
require MIME::Types;
require MIME::Type;
# Yeah, well, you never can be too sure :)
if(($MIME::Types::VERSION >= 1.005) && ($MIME::Type::VERSION >= 1.005)){
$file_ending =~ s/^\.//;
my $mimetypes = MIME::Types->new;
my MIME::Type $attachment_type = $mimetypes->mimeTypeOf($file_ending);
$a_type = $attachment_type;
}else{
# Alright, we're going to have to figure this one ourselves...
if(exists($MIME_TYPES{'.'.lc($file_ending)})) {
$a_type = $MIME_TYPES{'.'.lc($file_ending)};
}else{
# Drat! all hope is lost! Abandom ship!
$a_type = $DEFAULT_MIME_TYPE;
}
}
# This is called, "Last Ditch" right here.
# If we can't figure this out, just let MIME::List
# try to do what we just tried :)
if(!$a_type){
warn "attachment MIME Type never figured out, letting MIME::Lite handle this...";
$a_type = 'AUTO';
}
# two versions to upload files,
# one is upload -> save -> attach
if($ATTACHMENT_TEMPFILE == 1){
my $attachment_file = file_upload($this_attachment);
if($q->param('html_with_images') == 1){
$fancy_msg->attach(Type => $a_type,
Path => $attachment_file,
Id => '<'.$attach_name.'>',
'Content-Location' => $attach_name,
Filename => $attach_name,
);
}else{
$msg->attach(Type => $a_type,
Path => $attachment_file,
Filename => $attach_name,
Disposition => 'attachment',
);
}
}else{
#the other is 'magically' save.
if($q->param('html_with_images') == 1){
$fancy_msg->attach(
Type => $a_type,
FH => $get_attachment,
Id => '<'.$attach_name.'>',
'Content-Location' => $attach_name
);
}else{
$msg->attach(
Type => $a_type,
FH => $get_attachment,
Filename => $attach_name,
);
}
}
$attach_report .= "$attach_name
";
#save name fer later.
push(@attachments, $attach_name);
}
}
$attach_report .= "
';
print '
|
';
print '
|
$errors field$ending on this form $err_word filled out incorrectly and need to be fixed for all new information to be saved.
"; } print $GOOD_JOB_MESSAGE if(defined($done)); print $q->hidden('flavor', 'change_info'), $q->hidden('list', $list_info{list}), $q->hidden('process', 'true'); print $q->p('Your list\'s ', $q->b('short name'), 'is:', $q->b($q->i($list_info{list}))); print 'You did not fill in a list name
' if(defined($flags->{list_name}) == 1); print $q->p('What is the name of your list?', $q->br(), $q->textfield(-name=>'list_name', -value=>$list_info{list_name}, -size=>30)); print 'You need to give a valid e-mail address for the list owner
' if(defined($flags->{invalid_mojo_email}) == 1); print $q->p('What e-mail address corresponds to the list owner? When e-mails are sent, they are sent using this address.', $q->br(), $q->textfield(-name=>'mojo_email', -value=>$list_info{mojo_email}, -size=>30)), $q->p($q->i($q->b('optional')), 'What e-mail address corresponds to the list administrator?, All e-mail errors will be sent to this address, instead of the list owner. If left, blank, this job will be left to the list owner, which might be just fine for you.', $q->br(), $q->textfield(-name=>'admin_email', -value => $list_info{admin_email}, -size=>30)); print 'You need to give your list a description
' if(defined($flags->{list_info}) == 1); print $q->p("Description of $list_info{list_name}", $q->br(), $q->textarea(-name => 'info', -value => $list_info{info}, -cols => 33, -rows => 4, -wrap => 'VIRTUAL',)), $q->p($q->i($q->b('optional')), 'Would you like to write a small privacy policy summary? Some people don\'t subscribe to lists because they fear their e-mail addresses will be used for spamming purposes.', $q->br(), $q->textarea(-name => 'privacy_policy', -value => $list_info{private_policy}, -cols => 33, -rows => 4, -wrap => 'VIRTUAL',)); print submit_form(); print(admin_html_footer(-List => $list)); }else{ my ($list_errors, $list_flags) = check_list_setup(-fields => {list => $list, list_name => $list_name, mojo_email => $mojo_email, admin_email => $admin_email, private_policy => $privacy_policy, info => $info}, -new_list => 'no'); if ($list_errors >= 1){ undef $process; change_info($list_errors, $list_flags); }else{ $admin_email = $mojo_email if ($admin_email eq ""); my %new_info = (mojo_email => $mojo_email, admin_email => $admin_email, list => $list, list_name => $list_name, info => $info, private_policy => $privacy_policy, privacy_policy => $privacy_policy ); my $status = setup_list(\%new_info); user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0; print $q->redirect(-uri=>"$S_MOJO_URL?flavor=change_info&done=1"); } } } sub change_password { # a few variables my $root_login = check_list_security(-Admin_List => $admin_list, -Admin_Password => $admin_password, -IP_Address => $ENV{REMOTE_ADDR}, -Function => 'change_password'); require MOJO::Security::Password; $list = $admin_list; my %list_info = open_database(-List => $list, ); unless(defined($process)) { print(admin_html_header(-Title => "Change List Password", -List => $list_info{list}, -Root_Login => $root_login)); print $q->p('After you have changed your password, you will need to log back into this list\'s control panel.'); print $q->hidden('flavor', 'change_password'), $q->hidden('process', 'true'), $q->hidden('list', $list); if($root_login != 1){ print $q->p('Enter your old password:',$q->br(), $q->password_field('old_password')); } print $q->p('Enter your new password:', $q->br(), $q->password_field('new_password')), $q->p('Re-enter your new password:', $q->br(), $q->password_field('again_new_password')), submit_form(-Submit=>'Change Password'), (admin_html_footer(-List => $list)); }else{ my $old_password = $q -> param('old_password'); my $new_password = $q -> param('new_password'); my $again_new_password = $q -> param('again_new_password'); if($root_login != 1){ #check if the old password checks out, if it doesn't, throw an error my $password_check = MOJO::Security::Password::check_password($list_info{password},$old_password); user_error(-List => $list, -Error => "invalid_password") if ($password_check != 1); } #check to see if the new password is the same when typed twice. $new_password = strip($new_password); $again_new_password = strip($again_new_password); user_error(-List => $list, -Error => "pass_no_match") if ($new_password ne $again_new_password) || ($new_password eq ""); my $new_encrypt_pass = MOJO::Security::Password::encrypt_passwd($new_password); my %new_info = ( list => $list, password => $new_encrypt_pass ); my $status = setup_list(\%new_info); user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0; print $q->redirect(-uri=>"$S_MOJO_URL?flavor=admin"); } } sub delete_list { my $root_login = check_list_security( -Admin_List => $admin_list, -Admin_Password => $admin_password, -IP_Address => $ENV{REMOTE_ADDR}, -Function => 'delete_list' ); my $list = $admin_list; my (%list_info) = open_database(-List => $list, ); my $password_check = MOJO::Security::Password::check_password($admin_password, $list_info{password}); unless (defined($process)){ print(admin_html_header( -Title => "Confirm Delete List", -List => $list_info{list}, -Root_Login => $root_login )); print $q->p("Are you sure you want to totally delete this list?"), $q->p("This will delete the list and cannot be undone."), $q->hidden('flavor', 'delete_list'), $q->hidden('process', 'true'); print ""; print(admin_html_footer(-List => $list)); }else{ delete_email_list( -List => $list); delete_list_info( -List => $list); delete_list_archive( -List => $list); delete_list_template( -List => $list); require MOJO::Logging::Usage; my $log = new MOJO::Logging::Usage; $log->mj_log($list, 'List Removed', "remote_host:$ENV{REMOTE_HOST}, ip_address:$ENV{REMOTE_ADDR}") if $LOG{list_lives}; #print header(); my %default_list; my ($default_exists) = check_if_list_exists(-List=>$DEFAULT_LIST,); if($DEFAULT_LIST ne "" && $default_exists >= 1){ %default_list = open_database(-List =>$DEFAULT_LIST); } print(the_html( -Part => "header", -Title => "Deletion Successful", -List => $DEFAULT_LIST, )); print $q->p("You have deleted the list."); print $q->p("Return to the Mojo Mail main page."); print(the_html( -Part => "footer", -List => $DEFAULT_LIST, -Site_Name => $default_list{website_name}, -Site_URL => $default_list{website_url}, )); } } sub list_options { my $root_login = check_list_security( -Admin_List => $admin_list, -Admin_Password => $admin_password, -IP_Address => $ENV{REMOTE_ADDR}, -Function => 'list_options' ); #receive a few variables.. my $closed_list = $q->param("closed_list") || 0; my $hide_list = $q->param("hide_list") || 0; my $get_sub_notice = $q->param("get_sub_notice") || 0; my $get_unsub_notice = $q->param("get_unsub_notice") || 0; my $no_confirm_email = $q->param("no_confirm_email") || 0; my $unsub_confirm_email = $q->param("unsub_confirm_email") || 0; my $send_unsub_success_email = $q->param("send_unsub_success_email") || 0; my $mx_check = $q->param("mx_check") || 0; unless(defined($process)){ $list = $admin_list; my %list_info = open_database(-List => $list, ); print(admin_html_header( -Title => "Mailing List Options", -List => $list_info{list}, -Root_Login => $root_login)); #good job! print $GOOD_JOB_MESSAGE if(defined($done)); print "| "; print "\n"; print " | ";
print " Hide Your List |
| "; print "\n"; print " | ";
print " Close Your List |
| "; print "\n"; print " | ";
print " Receive Subscription Notices |
| "; print "\n"; print " | ";
print " Receive Unsubscription Notices |
| "; print "\n"; print " | ";
print " Send Subscription Confirmation Emails |
| "; print "\n"; print " | ";
print " Send Unsubscription Confirmation Emails |
| "; print "\n"; print " | ";
print " Send Unsubscription Successful Emails |
| "; print "\n"; print " | ";
print " Lookup Hostnames When Validating Email Addresses. |
\
" if $SHOW_HELP_LINKS == 1; print(admin_html_footer(-List => $list)); }else{ $list = $admin_list; my %list_info = open_database(-List => $list); my %new_info = ( list => $list_info{list}, hide_list => $hide_list, closed_list => $closed_list, get_sub_notice => $get_sub_notice, get_unsub_notice => $get_unsub_notice, no_confirm_email => $no_confirm_email, unsub_confirm_email => $unsub_confirm_email, send_unsub_success_email => $send_unsub_success_email, mx_check => $mx_check, ); my $status = setup_list(\%new_info); user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0; print $q->redirect(-uri=>"$S_MOJO_URL?flavor=list_options&done=1"); } } sub sending_options { my $root_login = check_list_security( -Admin_List => $admin_list, -Admin_Password => $admin_password, -IP_Address => $ENV{REMOTE_ADDR}, -Function => 'sending_options' ); $list = $admin_list; my %list_info = open_database(-List => $list, ); #a few variables my $bulk_send_amount = $q->param("bulk_send_amount"); my $bulk_send_seconds = $q->param("bulk_send_seconds"); my $bulk_send_seconds_label = $q->param("bulk_send_seconds_label"); my $precedence = $q->param('precedence'); my $charset = $q->param('charset'); my $content_type = $q->param('content_type'); my $enable_bulk_batching = $q->param("enable_bulk_batching") || 0; my $get_batch_notification = $q->param("get_batch_notification") || 0; my $get_finished_notification = $q->param("get_finished_notification") || 0; my $send_via_smtp = $q->param("send_via_smtp") || 0; unless(defined($process)){ my @message_amount = (1..25, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 350, 400, 450, 500, 1000, 1500, 2000, 4000, 6000, 8000, 10000); unshift(@message_amount, $list_info{bulk_send_amount}) if exists($list_info{bulk_send_amount}); my @message_wait = (1..60); unshift(@message_wait, $list_info{bulk_send_seconds}) if exists($list_info{bulk_send_seconds}); my @message_label = (1, 60, 3600); my %label_label = (1 => 'seconds', 60 => 'minutes', 3600 => 'hours', 86400 => 'days'); unshift(@message_label, $list_info{bulk_send_seconds_label}) if exists($list_info{bulk_send_seconds_label}); print(admin_html_header( -Title => "Sending Options", -List => $list_info{list}, -Root_Login => $root_login)); #good job! print $GOOD_JOB_MESSAGE if(defined($done)); print $q->p("$PROGRAM_NAME is able to send its bulk mailings in \"batches\", allowing you, to send to a fairly large list without browser timeouts, or your mail program, complaining about too many messages being sent at once."), $q->p("$PROGRAM_NAME will send as many individual messages as you specify., After that mailing is over it will wait the amount of time you set before it sends out its next batch., This pattern will repeat until all subscribers receive a copy of your message."); print "| "; print "\n"; print " | ";
print " Send E-mail Using SMTP send all e-mail from $PROGRAM_NAME using a straight SMTP connection "; print " instead of through a mail program such as sendmail. "; print "Warning! No SMTP Server has been set! " if((!$list_info{smtp_server}) && ($list_info{send_via_smtp} eq "1")); print ""; print " |
| "; print "\n"; print " | ";
print " Enable Batch Sending You must enable batch sending for batch sending to start working."; print "Lists under 100 people may not need it at all. "; print " |
| "; print "\n"; print " | ";
print " Receive Batch Confirmations Receive notices by e-mail every time"; print " a batch is complete. You'll be told what batch $PROGRAM_NAME is on and "; print " how many people have received your message so far. "; print " |
| "; print "\n"; print " | ";
print " Receive Finishing Message Receive notice by e-mail when $PROGRAM_NAME has sent all your list messages (when batching is enabled only). "; print " |
\
[?] Send Mailing List Messages in Batches
" if $SHOW_HELP_LINKS == 1; print(admin_html_footer(-List => $list)); }else{ my $bulk_sleep_amount = $bulk_send_seconds * $bulk_send_seconds_label; $list = $admin_list; my %list_info = open_database(-List => $list); my %new_info = ( list => $list_info{list}, bulk_send_amount => $bulk_send_amount, bulk_send_seconds => $bulk_send_seconds, bulk_send_seconds_label => $bulk_send_seconds_label, enable_bulk_batching => $enable_bulk_batching, bulk_sleep_amount => $bulk_sleep_amount, get_batch_notification => $get_batch_notification, get_finished_notification => $get_finished_notification, send_via_smtp => $send_via_smtp, ); my $status = setup_list(\%new_info); user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0; print $q->redirect(-uri=>"$S_MOJO_URL?flavor=sending_options&done=1"); } } sub adv_sending_options { my $root_login = check_list_security( -Admin_List => $admin_list, -Admin_Password => $admin_password, -IP_Address => $ENV{REMOTE_ADDR}, -Function => 'sending_options' ); $list = $admin_list; my %list_info = open_database(-List => $list, ); #a few variables my $precedence = $q->param('precedence'); my $priority = $q->param('priority'); my $charset = $q->param('charset'); my $content_type = $q->param('content_type'); my $strip_message_headers = $q->param('strip_message_headers') || 0; my $add_sendmail_f_flag = $q->param('add_sendmail_f_flag') || 0; my $print_return_path_header = $q->param('print_return_path_header') || 0; my $print_list_headers = $q->param('print_list_headers') || 0; unless(defined($process)){ print(admin_html_header( -Title => "Advanced Sending Options", -List => $list_info{list}, -Root_Login => $root_login)); print $GOOD_JOB_MESSAGE if(defined($done)); unshift(@CHARSETS, $list_info{charset}); print $q->table({-cellpadding => 5}, $q->Tr($q->td([$q->p($q->b('Default Precedence of Bulk Mailings')), $q->p($q->popup_menu( -name => "precedence", -value => [@PRECEDENCES], -default => $list_info{precedence} ))])), $q->Tr($q->td([$q->p($q->b('Default Priority of Bulk Mailings')), $q->p($q->popup_menu( -name => "priority", -value => [keys %PRIORITIES], -labels => \%PRIORITIES, -default => $list_info{priority} ))])), $q->Tr($q->td([$q->p($q->b('Default Character Set of Mailings')), $q->p($q->popup_menu( -name => 'charset', -value => [@CHARSETS], ))])), $q->Tr($q->td([$q->p($q->b('Default Content Type of Mailings')), $q->p($q->popup_menu( -name => 'content_type', -value => [@CONTENT_TYPES], -default => $list_info{content_type} ))])), ); print ""; print "\n"; print " | ";
print "Send all e-mails with only the address in the 'To' and 'From' message headers |
"; print "\n"; print " | ";
print "Print list-specific headers in all list emails |
"; print "\n"; print " | ";
print qq{Add the
Sendmail '-f' flag when sending messages, using $MAILPROG
Warning! Your effective uid is not the same as your real uid; using this option may break mail sending. " if $< != $>; print ' |
"; print "\n"; print " | ";
print qq{Print the 'Return-Path header in all list emails
|
| "; print "\n"; print " | ";
print " Use POP-before-SMTP Authentication"; print " A connection to your Pop Server will be created before any mail will be sent."; print "This can authenticate your outgoing mail requests, if your server uses POP-before-SMTP "; print " |
| '; print $q->p('Subscribers ', $q->b($start), ' to ' . $q->b(($length+$start))); print ' | '; print $q->p({-align => 'right'}, 'Total number of subscribers: ', $q->b($num_subscribers), $q->a({-href => $S_MOJO_URL . '?f=add'}, 'add...')); print ' |
| ' if($start-$length) >= 0 ; print ' | ' if($num_subscribers > ($start + $length)); print ' |
| ' if($start-$length) >= 0 ; print ' | ' if($num_subscribers > ($start + $length)); print ' |
The email address you typed is invalid.
' if $q->param('error') eq 'invalid_email'; print 'The email address you typed is already subscribed.
' if $q->param('error') eq 'email_subscribed'; print $q->p($q->b('email address: '), $q->textfield(-name => 'edit_email', -value => $email, -size => 30)); print $q->hidden(-name => 'email', -value => $email, -override=>1,); print $q->hidden(-name => 'f', -value => 'edit_subscriber', -override=>1); print $q->hidden(-name => 'process', -value => 'edit', -override=>1), $q->p({-align => 'right'}, $q->submit(-value => "Edit Information...", -style => $STYLE{yellow_submit})); print $q->end_form(); print $q->start_form(-action => $S_MOJO_URL, -method => 'POST'), $q->hidden('process', 'delete'), $q->hidden(-name => 'address', -value => $email), $q->hidden(-name => 'f', -value => 'checker', -override=>1), $q->p({-align => 'right'}, $q->submit(-value => "Delete Address", -style => $STYLE{red_submit})), $q->end_form(); print $q->p($q->a({-href => $S_MOJO_URL . '?f=view_list'}, '<- Back to Subscription List')); print qq{\n"; my $email_count = $q -> param("email_count"); if(defined($email_count)){ my $add_message = "$email_count people have been added successfully"; print $q->p("$add_message"); } my $delete_email_count = $q -> param("delete_email_count"); if(defined($delete_email_count)){ print "
",$delete_email_count; print " emails have been deleted
"; } #my $any_subscribers = -s "$FILES/$list.list"; # debug my $any_subscribers = 1; if($any_subscribers != 0){ print""; $SHOW_EMAIL_LIST = 0; my ($everyone, $domains_ref, $count_services_ref) = $lh->list_option_form(-List => $list, -In_Order => $LIST_IN_ORDER); =cut print ""; print "\n" if($SHOW_EMAIL_LIST ==1); print " | \n";
print <
There are a total of $everyone email addresses on $list_info{list_name}
EOF ; } if($SHOW_SERVICES_TABLE==1){ my $skey; my $svalue; my $using; my @skeys = sort(values %SERVICES); print $q->p("E-mail address sorted by popular E-mail or ISP Services, click on a service to see the list of e-mails from that particular service"); print <
|