" 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_PROGRAM_URL?flavor=$flavor"},'Basic...'));
}else{
print $q->p({-align=>'right'}, $q->a({-href=>"$S_PROGRAM_URL?flavor=$flavor&advanced=yes"},'Advanced...'));
}
# start the new form
print $q->start_multipart_form(-action=>$S_PROGRAM_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
;
print "
";
# this is all for the advanced form, we'll be switching from
# basic and advanced, so pay attention!
# print the From: field
# usually the list owner
print $q->Tr($q->td([
($q->p({-align=>'right'},($q->b('From:')))),
($q->p($q->textfield(-name =>'From',
-value =>'"'. escape_for_sending($list_info{list_name}) . '" <'.$list_info{list_owner_email}.'>',
-size => 49)))
])),
# print the 'Reply-To:' field
# usually the same as the From: field
$q->Tr($q->td([
($q->p({-align=>'right'},($q->b('Reply-To:')))),
($q->p($q->textfield(-name =>'Reply_To',
-value =>'"' . escape_for_sending($list_info{list_name}) . '" <'.$list_info{list_owner_email}.'>',
-size => 49)))
])),
(($list_info{print_errors_to_header} == 1) ?
(
# print the 'Errors-To' field
# usually the List Admin
$q->Tr($q->td([
($q->p({-align=>'right'},($q->b('Errors-To:')))),
($q->p($q->textfield(-name =>'Errors_To',
-value =>"<$list_info{admin_email}>",
-size => 49)))
])),
) : ()),
(($list_info{print_return_path_header} == 1) ?
(
# print the 'Return-Path' field
# usually the List Admin
$q->Tr($q->td([
($q->p({-align=>'right'},($q->b('Return-Path:')))),
($q->p($q->textfield(-name =>'Return_Path',
-value =>"<$list_info{admin_email}>",
-size => 49)))
])),
) : ()),
# print the Precedence, usually list
$q->Tr($q->td([
($q->p({-align=>'right'},($q->b('Precedence:')))),
($q->p($q->popup_menu(-name => 'Precedence',
-values => \@PRECEDENCES,
-default => $list_info{precedence})))
])),
#print the Priority, usually 3 or 'Normal'
$q->Tr($q->td([
($q->p({-align=>'right'},($q->b('Priority:')))),
($q->p($q->popup_menu(-name =>'Priority',
-values =>[keys %PRIORITIES],
-labels => \%PRIORITIES,
-default => $list_info{priority},
)))
]))if($advanced eq 'yes');
# print the subject
print $q->Tr($q->td([
($q->p({-align=>'right'},($q->b('Subject:')))),
($q->p($q->textfield(-name =>'message_subject',
-value =>"$message_subject",
-size => 49)))
]));
# this is where we print out the attachments if we be in 'advanced'
if($advanced eq 'yes'){
# tell us that we're using attachments
print $q->hidden('attachment', 'true');
# remember how many attachment files we have
print $q->hidden('at_num', $at_num);
# my $i
my $i;
# foreach of the $at_num's
for($i=1; $i<=$at_num; $i++){
# print a file upload form
print $q->Tr($q->td([
($q->p({-align=>'right'},$q->b("Attachment $i"))),
($q->p($q->filefield(-name=>"attachment_$i",-size => 36)))
]));
}
my $next_num = $at_num+1;
# and then print a link to make another one.
print $q->Tr($q->td([
$q->p(' '),
$q->p({-align=>'right'}, $q->i($q->a({-href=>"$S_PROGRAM_URL?flavor=$flavor&advanced=yes&at_num=$next_num"}, 'more attachment fields...'))),
]));
}
# give an option to *not* archive this message (adv)
print $q->Tr($q->td([
($q->p({-align=>'right'},($q->b('Options:')))),
($q->p(
$q->checkbox(-name => 'html_with_images',
-value => 1,
-label => 'HTML Version uses attached images',
)))
])),
$q->Tr($q->td([
($q->p(' ')),
($q->p($q->checkbox(-name =>'archive_message',
-value => 1,
-label => 'Archive This message',
(($list_info{archive_messages} ne "0") ?
(-checked => 'ON',) :
(-checked => '0',)),
)))
])),
$q->Tr($q->td([
($q->p(' ')),
($q->p($q->checkbox(-name => 'apply_template',
-value => 1,
-label => 'Apply the list template to the HTML message',
)))
])) if($advanced eq 'yes');
# print the 'Format' select box if we're in basic.
print $q->Tr($q->td([
($q->p({-align=>'right'},$q->b('Format:'))),
($q->p($format_options))
])) if($advanced ne 'yes');
print '
';
# print textfield('archive_message', $list_info{archive_messages}) if $advanced ne 'yes';
my $text_blurb = "";
my $html_blurb = "";
$text_blurb = "Text Version " if($advanced eq 'yes');
$html_blurb = "HTML Version " if($advanced eq 'yes');
# print one textarea...
print $q->p({-align=>'center'}, "$text_blurb",
$q->textarea(-name => 'text_message_body',
-cols => $cols,
-rows => $rows,
-wrap => $wrap,
-style => $text_area_style,
-value => $text_message_body));
# and another if we're in 'advanced'
print $q->p({-align=>'center'}, "$html_blurb",
$q->textarea(-name => 'html_message_body',
-cols => $cols,
-rows => $rows,
-wrap => $wrap,
-style => $text_area_style,
-value => $html_message_body)) if($advanced eq 'yes');
if(
($advanced eq 'yes') # &&
#($list_info{send_via_smtp} ne "1")
){
print $q->hr({-width=>'66%', -size=>1, -color=>'black'}),
$q->p({-align=>'center'}, $q->i('These two options are helpful if, for
some reason, your list mailing was
dropped mid sending - you\'ll be able
to pick up the mailing near where it
was left off')),
$q->p({-align=>'center'},'start this mailing at this address:', $q->br(),
$q->textfield(-name=>'Start-Email'), $q->br(),
$q->b('-or-'), $q->br(),
'start this mailing at email number:', $q->br(),
$q->textfield(-name=>'Start-Num', -size=>6), $q->br()),
$q->hr({-width=>'66%', -size=>1, -color=>'black'}),
}
#print qq{
#
#
Test Message Recipients:
#};
print <
I'm sure.
Open in a new window.
EOF
;
# end that, wasn't so bad eh?
print $q->end_form();
print qq{
}
if $SHOW_HELP_LINKS == 1;
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 $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_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\]/
} if $SHOW_HELP_LINKS == 1;
print(admin_html_footer(-List => $list));
exit; # what's up with this?
}else{
#######################################################################
#
#
# The code below is very similar to the 'add_email()' function, please note.
# Later on, I may take the below code and create a function from it.
#
#######################################################################
# q: what exactly are we doing here?
# a: we're filtering out the emails given to the script
# in various steps
my %seen;
# get the emails
my $new_emails = $q -> param("new_emails");
# split them into individual entities
my @new_addresses = split(/\s+|,|;|\n+/, $new_emails);
my @good_emails = ();
my @bad_emails = ();
my $invalid_email;
foreach my $check_this_address(@new_addresses) {
# see they're valid
my $pass_fail_address = check_for_valid_email($check_this_address);
if ($pass_fail_address >=1){
# save em if tey aint
push(@bad_emails, $check_this_address);
}else{
# save em if they are valid
$check_this_address = lc_email($check_this_address);
push(@good_emails, $check_this_address);
}
}
# this filters through the emails and takes out al duplicates
%seen = ();
my @unique_good_emails = grep { ! $seen{$_}++} @good_emails;
%seen = ();
my @unique_bad_emails = grep { ! $seen{$_}++} @bad_emails;
@unique_good_emails = sort(@unique_good_emails);
@unique_bad_emails =sort(@unique_bad_emails);
# this filters out emails addresses, taken them out of our list if they're already there
# figure out what unique emails we have from the new list when compared to the old list
my ($unique_ref, $not_unique_ref) = $lh->unique_and_duplicate(-New_List => \@unique_good_emails,
-List => $list);
#initialize
my @black_list;
my $found_black_list_ref;
my $clean_list_ref;
my $black_listed_ref;
my $black_list_ref;
if($list_info{black_list} eq "1"){
#open the black list
$black_list_ref = $lh->open_email_list(-List => $list, -Type => "black_list", -As_Ref=>1);
# now, from that new list of clean emails, see which ones are black listed
($found_black_list_ref) = $lh->get_black_list_match($black_list_ref, $unique_ref);
#now, tell me which ones still are ok.
($clean_list_ref, $black_listed_ref) = $lh->find_unique_elements($unique_ref, $found_black_list_ref);
}else{
$clean_list_ref = $unique_ref;
}
# add these to a special 'invitation' list. we'll clear this list later.
my $new_email_count=$lh->add_to_email_list(-Email_Ref => $clean_list_ref,
-List => $list_info{list},
-Type => 'invitelist',
-Mode => 'writeover');
#####################################################################
# SUBJECT #
###########
# get the message subject
my $message_subject = $q->param('message_subject');
#####################################################################
# TEXT #
########
# get the text message
my $text_message_body = DADA::App::Guts::strip($q->param('text_message_body')) || undef;
$text_message_body =~ s(/^\n+|\n+$)()g;
# if text version was passed,
if($text_message_body){
# get rid of weird line breaks caused by textareas
$text_message_body =~ s/\r\n/\n/g;
# interpolate [tags] to $tags
$text_message_body = interpolate_string(-String => $text_message_body, -List_Db_Ref => \%list_info);
}
#####################################################################
# HTML #
########
# get the HTML message (if any)
my $html_message_body = DADA::App::Guts::strip($q->param('html_message_body')) || undef;
$html_message_body =~ s(/^\n+|\n+$)()g;
if($html_message_body){
# get rid of weird line breaks
$html_message_body =~ s/\r\n/\n/g;
# interpolate [pusedo tags]
$html_message_body = interpolate_string(-String => $html_message_body,-List_Db_Ref => \%list_info);
}
my $s_link = subscribe_link(-list => $list,
-email => '[email]',
-pin => '[pin]');
my $us_link = unsubscribe_link(-list => $list,
-email => '[email]',
-pin => '[pin]');
# make unsub links
my $html_subscribe_link = "$s_link";
my $html_unsubscribe_link = "$us_link";
# make sub links
my $text_unsubscribe_link = $s_link;
my $text_subscribe_link = $us_link;
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;
}
require MIME::Lite;
MIME::Lite->quiet(1) if $MIME_HUSH == 1; ### I know what I'm doing
$MIME::Lite::PARANOID = $MIME_PARANOID;
my $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 -> attach(Type => 'TEXT', Data => $text_message_body);
$msg -> attach(Type => 'text/html', Data => $html_message_body);
}elsif($html_message_body){
# make only a text body
$msg = MIME::Lite->new(Type => 'text/html', Data => $html_message_body);
}else{
$msg = MIME::Lite->new(Type => 'TEXT', Data => $text_message_body);
}
$msg->replace('X-Mailer' =>"");
# get the header,
my $header_glob = $msg->header_as_string();
# get the body
my $message_string = $msg->body_as_string();
require DADA::Mail::Send;
my $mh = DADA::Mail::Send->new(\%list_info);
# translate the glob into a hash
my %headers = $mh -> return_headers($header_glob);
# make a mailing
my %mailing = (
%headers,
To => '"'. escape_for_sending($list_info{list_name}) .'" <'. $list_info{list_owner_email} .'>',
From => $list_info{list_owner_email},
Subject => $message_subject,
Body => $message_string);
# just testing?
$mh->list_type('invitelist');
$mh->bulk_test(1) if($process =~ m/test/i);
$mh->bulk_send(%mailing);
print(admin_html_header(-Title => "Invitations Sent",
-List => $list_info{list},
-Root_Login => $root_login));
$new_email_count = int($new_email_count);
if($process =~ m/test/i){
print $q->p("Your", $q->b($q->i("test")), " invitation message is being sent to the list owner,
($list_info{list_owner_email})");
}else{
print $q->p("$new_email_count invitation messages are now being sent. The list owner will also get a copy of this invitation message.");
}
print '
';
print(admin_html_footer(-List => $list));
if($q->param('save_invite_messages') == 1){
my $p_text_message_body = $q->param('text_message_body');
$p_text_message_body =~ s/\r\n/\n/g;
my $p_html_message_body = $q->param('html_message_body');
$p_html_message_body =~ s/\r\n/\n/g;
require DADA::MailingList::Settings;
my $ls = DADA::MailingList::Settings->new(-List => $list);
$ls->save({
invite_message_text => $p_text_message_body,
invite_message_html => $p_html_message_body,
invite_message_subject => $q->param('message_subject'),
});
}
}
}
sub send_url_email {
my $root_login = check_list_security(-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'send_url_email');
$list = $admin_list;
my %list_info = open_database(-List => $list);
if(!$process){
print(admin_html_header(
-Title => "Send A Webpage",
-List => $list_info{list},
-Root_Login => $root_login));
eval { require MIME::Lite::HTML};
if($@){
print $q->p($q->b($q->i("Sorry, this feature is not available on this server. Ask your server administrator to install the 'lwp Perl library")));
}else{
print $q->p('Send a web page to your subscribers. Enter the complete URL (including the http://)
of the webpage you want to send out. It\'s well advised that you send a test message before
committing on a real list sending.'),
$q->p($q->strong('Note:'), 'Mailing List Message email templates are not applied to webpage messages. It\'s advised that you put the necessary list information, including unsubscription links, into the webpage itself.'),
$q->p($q->b('Message Subject:'), $q->br(),
$q->textfield(-name =>'message_subject',
-value =>"$list_info{list_name} message",
-size => 49)),
$q->p($q->b('Web Page Address (URL):'), $q->br(),
$q->textfield(-name=>'url', size=>'65', -value=>'http://'));
print $q->p($q->strong($q->a({-href=>'#', -onclick => 'toggleDivDisplay(\'adv\')'}, 'Show/Hide Advanced Options')));
print '
'
if $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 $flags->{invalid_list_owner_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=>'list_owner_email', -value=>$list_info{list_owner_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 '
'
if $flags->{privacy_policy} == 1;
print $q->p('Please write a small privacy policy for your list.
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{privacy_policy},
-cols => 33,
-rows => 4,
-wrap => 'VIRTUAL',));
print '
You need to give your list a physical address.
'
if $flags->{physical_address} == 1;
print $q->p('What is the physical address associated with this mailing list?',
$q->br(),
$q->textarea(-name => 'physical_address',
-value => $list_info{physical_address},
-cols => 33,
-rows => 4,
-wrap => 'VIRTUAL',));
print submit_form();
print qq{
} if $SHOW_HELP_LINKS == 1;
print 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 = DADA::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 = DADA::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_PROGRAM_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 = DADA::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 $q->p($q->checkbox(
-name => 'delete_backups',
-value => 1,
-label => 'Delete List Backups',
-checked => 'checked',
));
print "";
print(admin_html_footer(-List => $list));
}else{
require DADA::MailingList::Archives;
my $ls = DADA::MailingList::Settings->new(-List => $list);
my $la = DADA::MailingList::Archives->new(-List => $ls->get);
my $lh = DADA::MailingList::Subscribers->new(-List => $list);
if($q->param('delete_backups') == 1){
$ls->removeAllBackups();
$la->removeAllBackups(1);
}
#mostly for the SQL backends
$lh->remove_this_listtype('list');
$lh->remove_this_listtype('blacklist');
$lh->remove_this_listtype('invitelist');
delete_email_list( -List => $list);
delete_list_info( -List => $list);
$la->delete_all_archive_entries();
delete_list_archive( -List => $list);
delete_list_template( -List => $list);
require DADA::Logging::Usage;
my $log = new DADA::Logging::Usage;
$log->mj_log($list, 'List Removed', "remote_host:$ENV{REMOTE_HOST}, ip_address:$ENV{REMOTE_ADDR}")
if $LOG{list_lives};
print(the_html(-Part => "header", -Title => "Deletion Successful"));
print $q->p("You have deleted the list.");
print $q->p("Return to the $PROGRAM_NAME main page.");
print(the_html(-Part => "footer"));
}
}
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 $send_sub_success_email = $q->param("send_sub_success_email") || 0;
my $mx_check = $q->param("mx_check") || 0;
my $use_alt_url_sub_confirm_success = $q->param("use_alt_url_sub_confirm_success") || 0;
my $alt_url_sub_confirm_success = $q->param( "alt_url_sub_confirm_success") || '';
my $use_alt_url_sub_confirm_failed = $q->param("use_alt_url_sub_confirm_failed") || 0;
my $alt_url_sub_confirm_failed = $q->param( "alt_url_sub_confirm_failed") || '';
my $use_alt_url_sub_success = $q->param("use_alt_url_sub_success") || 0;
my $alt_url_sub_success = $q->param( "alt_url_sub_success") || '';
my $use_alt_url_sub_failed = $q->param("use_alt_url_sub_failed") || 0;
my $alt_url_sub_failed = $q->param( "alt_url_sub_failed") || '';
my $use_alt_url_unsub_confirm_success = $q->param("use_alt_url_unsub_confirm_success") || 0;
my $alt_url_unsub_confirm_success = $q->param( "alt_url_unsub_confirm_success") || '';
my $use_alt_url_unsub_confirm_failed = $q->param("use_alt_url_unsub_confirm_failed") || 0;
my $alt_url_unsub_confirm_failed = $q->param( "alt_url_unsub_confirm_failed") || '';
my $use_alt_url_unsub_success = $q->param("use_alt_url_unsub_success") || 0;
my $alt_url_unsub_success = $q->param( "alt_url_unsub_success") || '';
my $use_alt_url_unsub_failed = $q->param("use_alt_url_unsub_failed") || 0;
my $alt_url_unsub_failed = $q->param( "alt_url_unsub_failed") || '';
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 $q->p($q->b('General'));
print "
\n";
print "
\n
";
print "\n";
print "
";
print "
Hide Your List ";
print "This list will not be listed on the $PROGRAM_NAME main screen. ";
print "This list will still have a list page and ";
print " people will still be able to subscribe/unsubscribe with the proper information.
You will also have to manually enter this";
print " list's shortname when logging onto the list control panel.
";
print "
";
print "
\n
";
print "\n";
print "
";
print "
Close Your List ";
print "No one will be allowed to subscribe to this list, subscribers can only be added via ";
print "from the administration control panel.";
print "People can still unsubscribe at any time";
print "
} 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,
send_sub_success_email => $send_sub_success_email,
mx_check => $mx_check,
use_alt_url_sub_confirm_success => $use_alt_url_sub_confirm_success,
alt_url_sub_confirm_success => $alt_url_sub_confirm_success,
use_alt_url_sub_confirm_failed => $use_alt_url_sub_confirm_failed,
alt_url_sub_confirm_failed => $alt_url_sub_confirm_failed,
use_alt_url_sub_success => $use_alt_url_sub_success,
alt_url_sub_success => $alt_url_sub_success,
use_alt_url_sub_failed => $use_alt_url_sub_failed,
alt_url_sub_failed => $alt_url_sub_failed,
use_alt_url_unsub_confirm_success => $use_alt_url_unsub_confirm_success,
alt_url_unsub_confirm_success => $alt_url_unsub_confirm_success,
use_alt_url_unsub_confirm_failed => $use_alt_url_unsub_confirm_failed,
alt_url_unsub_confirm_failed => $alt_url_unsub_confirm_failed,
use_alt_url_unsub_success => $use_alt_url_unsub_success,
alt_url_unsub_success => $alt_url_unsub_success,
use_alt_url_unsub_failed => $use_alt_url_unsub_failed,
alt_url_unsub_failed => $alt_url_unsub_failed,
);
my $status = setup_list(\%new_info);
user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0;
print $q->redirect(-uri=>"$S_PROGRAM_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 "
";
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.
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 "
";
print "
";
print "\n";
print "
";
print "
Receive Finishing Message Receive notice by e-mail when $PROGRAM_NAME has sent all your list messages.
} 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_PROGRAM_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 $plaintext_encoding = $q->param('plaintext_encoding');
my $html_encoding = $q->param('html_encoding');
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_errors_to_header = $q->param('print_errors_to_header') || 0;
my $print_list_headers = $q->param('print_list_headers') || 0;
my $use_habeas_headers = $q->param('use_habeas_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 PlainText Message Encoding')),
$q->p($q->popup_menu(
-name => 'plaintext_encoding',
-value => [@CONTENT_TRANSFER_ENCODINGS],
-default => $list_info{plaintext_encoding},
)
)])),
$q->Tr(
$q->td([
$q->p(
$q->b('Default HTML Message Encoding')),
$q->p($q->popup_menu(
-name => 'html_encoding',
-value => [@CONTENT_TRANSFER_ENCODINGS],
-default => $list_info{html_encoding},
)
)])),
$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 "
";
print "\n";
print "
";
print "Send all e-mails with only the address in the 'To' and 'From' message headers ";
print "Some SMTP servers get confused when 'To:' and 'From:' mail headers contain both the address and name (example: "John Smith" <johm\@smith.com>) ";
print "All messages sent will only contain the actual address (example: john\@smith.com)
";
print '
';
print "
";
print "\n";
print "
";
print "Print list-specific headers in all list emails ";
print "List-specific headers store information on how to subscribe and unsubscribe from a list, as well as other list specific information, in the header of the email.";
print " It is highly advised to take advantage of these headers.
Warning! Your effective uid is not the same as your real uid;
using this option may break mail sending.
" if $< != $>;
print '
';
print "
";
print "\n";
print "
";
print qq{Print the 'Errors-To' header in all list emails The 'Errors-To' header is used to tell mail servers where to direct a message when an error in delivery occurs.
This header has been deprecated
};
print '
';
print "
";
print "\n";
print "
";
print qq{Print the 'Return-Path header in all list emails The 'Return-Path' header works much like setting the '-f' flag. Alternatives to Sendmail (like Qmail)
allow you to use the Return-Path header.
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 SMTP server uses POP-before-SMTP or your SMTP server does not use SASL.
Set the Sender of SMTP mailings to the list administration email address";
print " This will ultimately set the 'Return-Path' email header to the list administration email address
($list_info{admin_email}), and bounced messages will return to that address. Otherwise,
they will go to the list owner.";
print "
";
print "
";
print $q->hidden('process', 'true');
print $q->hidden('list', $list);
print $q->hidden('flavor', 'smtp_options');
print $q->hr();
print submit_form();
print(admin_html_footer(-List => $list));
}else{
my $use_pop_before_smtp = $q->param('use_pop_before_smtp') || 0;
my $set_smtp_sender = $q->param('set_smtp_sender') || 0;
my $smtp_server = strip($q->param('smtp_server'));
my $pop3_server = strip($q->param('pop3_server'));
my $pop3_username = strip($q->param('pop3_username'));
my $pop3_password = strip($q->param('pop3_password'));
my $use_sasl_smtp_auth = $q->param('use_sasl_smtp_auth') || 0;
my $sasl_smtp_username = strip($q->param('sasl_smtp_username'));
my $sasl_smtp_password = strip($q->param('sasl_smtp_password'));
my %ni = (
list => $list_info{list},
smtp_port => $q->param('smtp_port'),
smtp_connect_tries => $q->param('smtp_connect_tries'),
use_pop_before_smtp => $use_pop_before_smtp,
smtp_server => $smtp_server,
pop3_server => $pop3_server,
pop3_username => $pop3_username,
pop3_password => DADA::Security::Password::cipher_encrypt($list_info{cipher_key}, $pop3_password),
use_sasl_smtp_auth => $use_sasl_smtp_auth,
sasl_smtp_username => $sasl_smtp_username,
sasl_smtp_password => DADA::Security::Password::cipher_encrypt($list_info{cipher_key}, $sasl_smtp_password),
set_smtp_sender => $set_smtp_sender,
);
my $status = setup_list(\%ni);
user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0;
print $q->redirect(-uri=>"$S_PROGRAM_URL?flavor=smtp_options&done=1");
}
}
sub checkpop {
my $root_login = check_list_security(-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'dada_send_options',
);
$list = $admin_list;
require DADA::Security::Password;
my $user = $q->param('user');
my $pass = $q->param('pass');
my $server = $q->param('server');
my %list_info = open_database(-List => $list);
require DADA::Mail::Send;
my $mh = DADA::Mail::Send->new(\%list_info);
my $pop_status;
if(!$user || !$pass || !$server){
$pop_status = undef;
}else{
$pop_status = $mh->_pop_before_smtp(-pop3_server => $server,
-pop3_username => $user,
-pop3_password => $pass);
}
print $q->header();
if(defined($pop_status)){
print $q->h2("Success!");
print $q->p($q->b("POP-before-SMTP authentication was successful"));
print $q->p($q->b("Make sure to 'Save Changes' to have your edits take affect."));
}else{
print $q->h2("Warning!");
print $q->p($q->b('POP-before-SMTP authentication was ',$q->i('unsuccessful'),));
}
}
sub dada_send_options {
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'dada_send_options');
$list = $admin_list;
my %list_info = open_database(-List => $list);
#a few variables
my $group_list = $q->param('group_list') || 0;
my $allow_group_interpolation = $q->param('allow_group_interpolation') || 0;
my $only_allow_group_plain_text = $q->param('only_allow_group_plain_text') || 0;
my $append_list_name_to_subject = $q->param('append_list_name_to_subject') || 0;
my $mail_group_message_to_poster = $q->param('mail_group_message_to_poster') || 0;
my $add_reply_to = $q->param('add_reply_to') || 0;
unless(defined($process)){
print(admin_html_header(
-Title => "Group Options",
-List => $list_info{list},
-Root_Login => $root_login));
print $GOOD_JOB_MESSAGE if(defined($done));
print $q->p("You can use the dada_send.pl to send e-mails using your mail reader,
such as Outlook or Eudora. dada_send.pl can also be used to set up group lists,
where everyone on your list will be able to send to everyone else on your list,
using a special address"),
$q->p("Please be sure that dada_send.pl is properly installed before you use it!"),
$q->table(
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'group_list',
-value => 1,
-label=>'',
(($list_info{group_list} eq "1") ?
(-checked=>'ON') :
(-checked=> 0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(0)', -class=>'black'}, 'Make Your List a Group List')), $q->br(),
'Everyone subscribed to your list can send to e-mails to everyone else on your list.'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'allow_group_interpolation',
-value => 1,
-label=>'',
(($list_info{allow_group_interpolation} eq "1") ?
(-checked=>'ON') :
(-checked=>0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(1)', -class=>'black'}, 'Allow Variable Interpolation In Group Mailings')), $q->br(),
"Variable Interpolation means that pseudo tags like this: [program_url] will be changed to what they really are ($PROGRAM_URL) "))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'only_allow_group_plain_text',
-value => 1,
-label=>'',
(($list_info{only_allow_group_plain_text} eq "1") ?
(-checked=>'ON') :
(-checked=>0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(2)', -class=>'black'}, 'Only Allow Plain Text Messages To Be Sent From Group Members')), $q->br(),
'Only e-mails seen as being plain text (no HTML) will be allowed to post to the group'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'append_list_name_to_subject',
-value => 1,
-label=>'',
(($list_info{append_list_name_to_subject} ne "0") ?
(-checked=>'ON') :
(-checked=>0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(3)', -class=>'black'}, 'Add the list name to the subject of group mailings')), $q->br(),
'List messages will be sent out with the list name at the beginning of the message, surrounded by brackets. This
helps subscribers with identifying an e-mail message that originates from your list.'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'add_reply_to',
-value => 1,
-label=>'',
(($list_info{add_reply_to} ne "0") ?
(-checked=>'ON') :
(-checked=>0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(4)', -class=>'black'}, 'Automatically have replies to messages directed to the group')), $q->br(),
'A \'Reply-To\' header will be added to group list mailings that will direct replys to list messages back to the list.'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'mail_group_message_to_poster',
-value => 1,
-label=>'',
(($list_info{mail_group_message_to_poster} ne "0") ?
(-checked=>'ON') :
(-checked=>0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(5)', -class=>'black'}, 'Send Posters Their Own Message')), $q->br(),
'People who post messages to the list will receive their own email messages.'))
])
),
);
print $q->hidden('flavor','dada_send_options'),
$q->hidden('process','true');
print submit_form();
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);
if($SHOW_DOMAIN_TABLE == 1) {
#initialize some variables
my $key;
my $value;
my $everyone_else = $domains_ref -> {Other};
print <E-mail addresses sorted by Top Level Domains,
click on the particular domain to view the list of
e-mails from that top level domain
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 <
} if $SHOW_HELP_LINKS == 1;
}
}else{
print $NO_ONE_SUBSCRIBED;
}
print(admin_html_footer(-List => $list));
}
sub add {
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'add'
);
# view whos on the list, add delete addresses
$list = $admin_list;
my %list_info = open_database(-List => $list);
my $lh = DADA::MailingList::Subscribers->new(-List => $list);
my $num_subscribers = $lh->num_subscribers;
print(admin_html_header(
-Title => "Manage Additions",
-List => $list_info{list},
-Root_Login => $root_login,
-Form => 0));
if($list_info{use_subscription_quota} == 1){
if($num_subscribers >= $list_info{subscription_quota}){
print $q->p({-class => 'smallred'}, 'Warning! You are at or above the number of subscribers allowed ('.$list_info{subscription_quota}.')!
You cannot add anymore subscribers.');
}else{
print $q->p({-class => 'smallred'}, 'You have a limit of '. $list_info{subscription_quota} .' total subscribers. You currently have '.$num_subscribers.' subscribers.');
}
}
unless(($list_info{use_subscription_quota} == 1) && ($num_subscribers >= $list_info{subscription_quota})){
print $q->p("To Add e-mails, enter the addresses below, separated by
spaces, commas or carriage returns. Extemely large lists
added (over 1000 addresses) may take a minute or two to
process, so please exercise patience.");
print $q->p($q->start_multipart_form(-action=>$S_PROGRAM_URL, -method=>'POST', -name=>'default_form'),
$q->hidden(-name =>'flavor', -value => 'add_email', -override=>1),
$q->textarea(-name=>'new_emails',
-cols=>40,
-rows=>4),
'
Skip Confirmation Screen');
print $q->p("Alternatively, import from a file containing the email addresses would like
to be added to the list", $q->br(),
$q->filefield(-name => 'new_email_file'));
print "";
print $q->end_form();
print qq{
} if $SHOW_HELP_LINKS == 1;
print(admin_html_footer(-List => $list));
}
}
sub add_email {
my $root_login = check_list_security(-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'add_email');
my %seen;
$list = $admin_list;
my %list_info = open_database( -List => $list);
my $lh = DADA::MailingList::Subscribers->new(-List => $list);
unless (defined($process)){
my $new_emails;
my $email_file = $q->param('new_email_file');
if(DADA::App::Guts::strip($q->param("new_emails")) ne ""){
$new_emails = $q->param("new_emails");
}else{
if($email_file){
my $new_file = file_upload('new_email_file');
open(UPLOADED, "$new_file") or die $!;
{
local $/ = undef;
$new_emails = ;
}
close(UPLOADED);
unlink($new_file) or warn "could not remove uploaded subscriber list, '$new_file': $!";
}
}
my @new_addresses = split(/\s+|,|;|\n+/, $new_emails);
my @good_emails = ();
my @bad_emails = ();
my $invalid_email;
foreach my $check_this_address(@new_addresses) {
my $pass_fail_address = check_for_valid_email($check_this_address);
if ($pass_fail_address >=1){
push(@bad_emails, $check_this_address);
}else{
$check_this_address = lc_email($check_this_address);
push(@good_emails, $check_this_address);
}
}
%seen = ();
my @unique_good_emails = grep { ! $seen{$_}++} @good_emails;
%seen = ();
my @unique_bad_emails = grep { ! $seen{$_}++} @bad_emails;
@unique_good_emails = sort(@unique_good_emails);
@unique_bad_emails =sort(@unique_bad_emails);
# figure out what unique emails we have from the new list when compared to the old list
my ($unique_ref, $not_unique_ref) = $lh->unique_and_duplicate(-New_List => \@unique_good_emails,
-List => $list);
#initialize
my @black_list;
my $found_black_list_ref;
my $clean_list_ref;
my $black_listed_ref;
my $black_list_ref;
if($list_info{black_list} eq "1"){
#open the black list
$black_list_ref = $lh->open_email_list( -List => $list, -Type => "black_list", -As_Ref=>1);
# now, from that new list of clean emails, see which ones are black listed
($found_black_list_ref) = $lh->get_black_list_match($black_list_ref, $unique_ref);
#now, tell me which ones still are ok.
($clean_list_ref, $black_listed_ref) = $lh->find_unique_elements($unique_ref, $found_black_list_ref);
}else{
$clean_list_ref = $unique_ref;
}
my $num_subscribers = $lh->num_subscribers;
# *whew* #
if((($num_subscribers + $#$clean_list_ref) >= $list_info{subscription_quota}) && ($list_info{use_subscription_quota} == 1)){
$quick = 'no';
}
if($quick eq "yes"){
#my @address = $q -> param("address");
my $new_email_count=$lh->add_to_email_list(-Email_Ref => $clean_list_ref,
-List => $list_info{list}
);
print $q -> redirect(-uri=>"$S_PROGRAM_URL?flavor=view_list&email_count=$new_email_count");
}else{
print(admin_html_header(
-Title => "Verify Additions",
-List => $list_info{list},
-Root_Login => $root_login));
unless( (($num_subscribers + $#$clean_list_ref) >= $list_info{subscription_quota}) && ($list_info{use_subscription_quota} == 1)){
print "
EOF
;
foreach(@$clean_list_ref){
print" $_ \n";
}
print <check all :: uncheck all
EOF
;
if($list_info{black_list} eq "1"){
print $q->p("These addresses are Black Listed and won't be added unless they are checked ")if(defined(@$black_listed_ref[0]));
foreach(@$black_listed_ref){
print " ", $_, " \n";
}
}
print $q->p("These addresses are already subscribed to $list_info{list_name}, so they won't be added again:
" if(defined(@$not_unique_ref[0]));
print $q->p("These addresses did not go through validation successfully. Perhaps you typed them incorrectly? To correct, push your back button and enter again
"if(defined($unique_bad_emails[0]));
}else{
print $q->p({-class => 'smallred'}, 'Warning! You cannot subscribe all the addresses that you have submitted, since you will go over your subscription limit of ' .$list_info{subscription_quota} . ' subscribers. Please resubmit a smaller amount of addresses to subscribe. ');
}
print(admin_html_footer(-List => $list));
}
}else {
my @address = $q -> param("address");
my $new_email_count=$lh->add_to_email_list(-Email_Ref => \@address,
-List => $list_info{list}
);
print $q -> redirect(-uri=>"$S_PROGRAM_URL?flavor=view_list&email_count=$new_email_count");
}
}
sub delete_email{
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'delete_email'
);
# view whos on the list, add delete addresses
$list = $admin_list;
my %list_info = open_database(-List => $list);
my $lh = DADA::MailingList::Subscribers->new(-List => $list);
#my $any_subscribers = -s "$FILES/$list.list";
# debug
my $any_subscribers = 1;
if($any_subscribers == 0){
print(admin_html_header(
-Title => "Manage Deletions",
-List => $list_info{list},
-Root_Login => $root_login
));
print $NO_ONE_SUBSCRIBED;
print(admin_html_footer(-List => $list));
}
unless(defined($process)){
print(admin_html_header(
-Title => "Manage Deletions",
-List => $list_info{list},
-Root_Login => $root_login
));
print '
To delete an e-mail, enter it into Your Delete List';
print 'You can also pick the e-mail from Your Subscription List (if available).
Scroll through the e-mail addresses, select it and press
Copy to Delete List>>.' if($SHOW_EMAIL_LIST ==1);
print ' After you are finished, press Submit E-mail List
" if(defined($unique_ref -> [0]));
#
#
#
print $q->p("These addresses did not go through validation successfully. Perhaps you typed them incorrectly? To correct, push your back button and enter again
"if(defined($unique_bad_emails[0]));
print(admin_html_footer(-List => $list));
}
}
sub black_list {
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'black_list'
);
my $black_list = $q->param("black_list");
# view whos on the list, add delete addresses
$list = $admin_list;
my %list_info = open_database(-List => $list);
my $lh = DADA::MailingList::Subscribers->new(-List => $list);
if($process eq "add"){
my $black_list_add = strip($q->param('black_list_add'));
$black_list_add =~ s(/^\n+|\n+$)()g;
if($black_list_add){
$lh->add_to_email_list(-List => $list,
-Email_Ref => [$black_list_add],
-Type => "black_list"
);
}
}
if($process eq "delete"){
my $rm_status = $lh->remove_from_list(
-List => $list,
-Email_List => \@address,
-Type => "black_list",
);
#are these even relevant anymore?
user_error(-List => $list, -Error => 'no_list') if $rm_status eq 'no list';
user_error(-List => $list, -Error => 'too_busy') if $rm_status eq 'too busy';
}
if($process eq "switch"){
my %new_info = (
list => $list_info{list},
black_list => $black_list,
);
my $status = setup_list(\%new_info);
user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0;
$done = 1;
$list_info{black_list} = $black_list;
}
if($process eq 'options'){
my $add_unsubs_to_black_list = $q -> param('add_unsubs_to_black_list') || 0;
my $allow_blacklisted_to_subscribe = $q -> param('allow_blacklisted_to_subscribe') || 0;
my $allow_admin_to_subscribe_blacklisted = $q -> param('allow_admin_to_subscribe_blacklisted') || 0;
my %new_info = (
list => $list_info{list},
add_unsubs_to_black_list => $add_unsubs_to_black_list,
allow_blacklisted_to_subscribe => $allow_blacklisted_to_subscribe,
allow_admin_to_subscribe_blacklisted => $allow_admin_to_subscribe_blacklisted,
);
my $status = setup_list(\%new_info);
user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0;
print $q -> redirect(-uri=>"$S_PROGRAM_URL?flavor=black_list&done=1");
exit(); #huh?
}
print(admin_html_header(
-Title => "Black List Rules",
-List => $list_info{list},
-Root_Login => $root_login
));
print $GOOD_JOB_MESSAGE if(defined($done));
print <A black list is like a set of rules that say who cannot subscribe to
your list. You can disallow a single e-mail address by adding that e-mail
address (you\@yours.com) to the black list.
You can also use the black list
to match a part of an e-mail address, adding '.com' to the black list will disallow
anyone that has '.com' in their e-mail address.
";
print(admin_html_footer(-List => $list));
}
}
sub delete_archive {
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'delete_archive'
);
$list = $admin_list;
my @address = $q -> param("address");
my %list_info = open_database(-List => $list);
# let's get some info on this archive, shall we?
require DADA::MailingList::Archives;
my $archive = DADA::MailingList::Archives -> new(-List => \%list_info);
my $entries = $archive -> get_archive_entries();
#ok, that's cool.
my $entry;
#{
#local $| = 0;
foreach $entry(@address){
my $exists = $archive -> check_if_entry_exists($entry);
$archive -> delete_archive($entry) if($exists >= 1);
}
#}
print $q->redirect(-uri=>"$S_PROGRAM_URL?flavor=view_archive");
}
sub edit_archive {
#security checks..
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'edit_archive'
);
my $archive_subject = $q->param("archive_subject");
my $archive_message = $q->param("archive_message");
my $archive_format = $q->param("archive_format");
my $new_archive = $q->param("new_archive");
$list = $admin_list;
my %list_info = open_database(-List => $list);
require DADA::MailingList::Archives;
my $archive = DADA::MailingList::Archives->new(-List => \%list_info);
my $entries = $archive -> get_archive_entries();
# what to do?
if($process eq "true"){
# safe some information
$archive_message =~ s/\r\n/\n/g;
if($new_archive){
$id = sprintf("%02d", $q->param('year')) .
sprintf("%02d", $q->param('month')) .
sprintf("%02d", $q->param('day')) .
sprintf("%02d", $q->param('hour')) .
sprintf("%02d", $q->param('minute')) .
sprintf("%02d", $q->param('second'));
}
#{
#local $| = 0;
$archive->set_archive_info($id, $archive_subject, $archive_message, $archive_format);
#}
# and go
print $q->redirect(-uri=>"$S_PROGRAM_URL?flavor=edit_archive&id=$id&done=1");
}else{
print(admin_html_header(
-Title => "Archived Messages: Edit",
-List => $list_info{list},
-Root_Login => $root_login
));
print $GOOD_JOB_MESSAGE if(defined($done));
my $the_archive_subject = "";
my $the_archive_message = "";
my $the_archive_format = 'text/plain';
if(!$new_archive){
($the_archive_subject, $the_archive_message, $the_archive_format) = $archive->get_archive_info($id);
}
print $q->p($q->b('Date:'), $q->br(), $q->popup_menu(-name => 'month', -value => [1..12]), '/',
$q->popup_menu(-name => 'day', '-values' => [1..31]), '/',
$q->popup_menu(-name => 'year', '-values' => [1980 .. 2100]), '-',
$q->popup_menu(-name => 'hour', '-values' => [0..23]), ':',
$q->popup_menu(-name => 'minute', '-values' => [0..59]), ':',
$q->popup_menu(-name => 'second', '-values' => [0..59])) if $new_archive;
print $q->p('Subject: ',$q->textfield(-size=>49,-name=>'archive_subject', -value=>$the_archive_subject)),
$q->p('Message: ',$q->textarea(-name=>'archive_message', -value=>$the_archive_message, -rows=>20,-columns=>50)),
$q->hidden('flavor','edit_archive'),
$q->hidden('process','true'),
$q->table($q->Tr($q->td([
$q->p('Treat this message as:'),
$q->p($q->popup_menu(-name =>'archive_format',
'-values' =>[$the_archive_format, 'HTML', 'Text'])),
])));
print $q->hr();
print $q->hidden('id',$id) if ! $new_archive;
print $q->hidden('new_archive', 1) if $new_archive;
if(! $new_archive){
print submit_form(-Submit => 'Edit Archived Message');
}else{
print submit_form(-Submit => 'Create New Archived Message');
}
print $archive->make_nav_table(-Id => $id, -List => $list_info{list}, -Function => "admin") if ! $new_archive;
$the_archive_message = webify_plain_text($the_archive_message) if($the_archive_format !~ /HTML/i);
print $q->p('This Message currently appears as:'),
$q->table({-width=>'100%',-border=>0, -cellpadding=>1, -cellspacing=>0,-bgcolor=>'#000000'},
$q->Tr($q->td(
$q->table({-width=>'100%',-border=>0, -cellpadding=>5, -cellspacing=>0,-bgcolor=>'#FFFFFF'},
$q->Tr($q->td(
$q->h3($the_archive_subject),
$q->p($the_archive_message)
)))
))) if !$new_archive;
print(admin_html_footer(-List => $list));
}
}
sub archive_options {
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'archive_options'
);
# a few variables...
my $show_archives = $q->param('show_archives') || 0;
my $archive_messages = $q->param('archive_messages') || 0;
my $archive_subscribe_form = $q->param('archive_subscribe_form') || 0;
my $archive_search_form = $q->param('archive_search_form') || 0;
my $archive_send_form = $q->param('archive_send_form') || 0;
unless(defined($process)){
$list = $admin_list;
my %list_info = open_database(-List => $list);
print(admin_html_header(
-Title => "Archives Options",
-List => $list_info{list},
-Root_Login => $root_login
));
#good job!
print $GOOD_JOB_MESSAGE if(defined($done));
print $q->table({-cellpadding=>5},
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'archive_messages',
-value => 1,
-label=>'',
(($list_info{archive_messages} ne "0") ?
(-checked=>'ON') :
(-checked=> 0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(0)', -class=>'black'}, 'Archive Your Messages')), $q->br(),
'Any messages already archived will still be available to your visitors'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'show_archives',
-value => 1,
-label=>'',
(($list_info{show_archives} ne "0") ?
(-checked=>'ON') :
(-checked=> 0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(1)', -class=>'black'}, 'Display Your Archives')), $q->br(),
'Messages will still be archived unless you choose not to above. Archived messages will still be viewable in your control panel'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'archive_subscribe_form',
-value => 1,
-label=>'',
(($list_info{archive_subscribe_form} ne "0") ?
(-checked=>'ON') :
(-checked=> 0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(2)', -class=>'black'}, 'Add a Subscription Form to the Archive Pages')), $q->br(),
'A subscription form will be added with the name of the list and the description of list at the bottom of every archive page.'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'archive_search_form',
-value => 1,
-label=>'',
(($list_info{archive_search_form} eq "1") ?
(-checked=>'ON') :
(-checked=> 0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(3)', -class=>'black'}, 'Add a Search Form to the Archive Pages')), $q->br(),
'Allow your visitors to easily search through your list\'s archives'))
])
),
$q->Tr(
$q->td({-valign=>'top'},[
($q->checkbox(-name => 'archive_send_form',
-value => 1,
-label=>'',
(($list_info{archive_send_form} eq "1") ?
(-checked=>'ON') :
(-checked=> 0)),
)),
($q->p($q->b($q->a({-href=>'javascript:checklink(4)', -class=>'black'}, 'Add a "send this archive to a friend" form')), $q->br(),
'Visitors will be able to send archived messages they find interesting to friends'))
])
),
);
print $q->p({-align=>'right'},$q->a({-href =>"$S_PROGRAM_URL?flavor=adv_archive_options"}, 'Advanced...'));
print "";
print $q->hidden('process', 'true'),
$q->hidden('flavor', 'archive_options');
print submit_form(-Submit=>'Change Archive Options');
print(admin_html_footer(-List => $list));
}else{
$list = $admin_list;
my %list_info = open_database(-List => $list);
my %new_info = (
list => $list_info{list},
show_archives => $show_archives,
archive_messages => $archive_messages,
archive_subscribe_form => $archive_subscribe_form,
archive_search_form => $archive_search_form,
archive_send_form => $archive_send_form);
my $status = setup_list(\%new_info);
user_error(-List => $list, -Error => "no_permissions_to_write") if $status == 0;
print $q -> redirect(-uri=>"$S_PROGRAM_URL?flavor=archive_options&done=1");
}
}
sub adv_archive_options {
my $root_login = check_list_security(
-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'adv_archive_options'
);
my $sort_archives_in_reverse = $q->param('sort_archives_in_reverse') || 0;
my $archive_show_year = $q->param('archive_show_year') || 0;
my $archive_show_month = $q->param('archive_show_month') || 0;
my $archive_show_day = $q->param('archive_show_day') || 0;
my $archive_show_hour_and_minute = $q->param('archive_show_hour_and_minute') || 0;
my $archive_show_second = $q->param('archive_show_second') || 0;
my $archive_index_count = $q->param('archive_index_count') || 10;
my $stop_message_at_sig = $q->param('stop_message_at_sig') || 0;
my $publish_archives_rss = $q->param('publish_archives_rss') || 0;
unless(defined($process)){
$list = $admin_list;
my %list_info = open_database(-List => $list);
print(admin_html_header(-Title => "Archives Options",
-List => $list_info{list},
-Root_Login => $root_login));
my @index_this=("$list_info{archive_index_count}",1..10,15,20,25,30,40,50,75,100);
#good job!
print $GOOD_JOB_MESSAGE if(defined($done));
print "
";
print "
";
print "\n";
print "
";
print "
Show archive messages until the message signature ";
print "Archived messages will be displayed until double dashes ('--'),
are reached in the message. This is a popular convention to clue systems that work with e-mail
as to where the message stops and the signature begins.
";
print "
";
print "
";
print " ";
print "
";
print "
Sort Your Archives In: ";
print "Chronological Order \n";
print "Reverse Chronological Order \n";
print "
';
print $q->table({-align=>'center',cellpadding=>1},
$q->Tr($q->td([$q->p('Show the archived message index ')])),
$q->Tr($q->td([$q->p('with',$q->popup_menu(-name=>'archive_index_count',
-value=>[@index_this],
-style =>'font-family:arial;font-size:11px;'),
'links at a time')
])));
print "
";
print $q->p({-align=>'right'},$q->a({-href =>"$S_PROGRAM_URL?flavor=archive_options"}, 'Basic...'));
print "";
print $q->hidden('process', 'true'),
$q->hidden('flavor', 'archive_options');
print submit_form(-Submit=>'Change Archive Options');
print(admin_html_footer(-List => $list));
}else{
$list = $admin_list;
my %list_info = open_database(-List => $list);
my %new_info = (
list => $list_info{list},
stop_message_at_sig => $stop_message_at_sig,
sort_archives_in_reverse => $sort_archives_in_reverse,
archive_show_year => $archive_show_year,
archive_show_month => $archive_show_month,
archive_show_day => $archive_show_day,
archive_show_hour_and_minute => $archive_show_hour_and_minute,
archive_show_second => $archive_show_second,
archive_index_count => $archive_index_count,
publish_archives_rss => $publish_archives_rss,
);
my $status = setup_list(\%new_info);
user_error(-List => $list, -Error =>"no_permissions_to_write") if $status == 0;
print $q -> redirect(-uri=>"$S_PROGRAM_URL?flavor=adv_archive_options&done=1");
}
}
sub html_code {
my $root_login = check_list_security(-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'html_code');
$list = $admin_list;
my %list_info = open_database(-List => $list);
print(admin_html_header(-Title => "Cut and Paste Code",
-List => $list_info{list},
-Root_Login => $root_login));
print $q->p("You may change what the signup form will look like by typing
what you want in the text boxes below. Click \"set\" to change
the code in the main text box, click preview to see what it
will look like.");
print <
Form Field Size
Form Field Label
Put Subscription Unsubscription Radio Buttons?
Button Label
EOF
;
if($HTML_FOOTER){
print <
Give $PROGRAM_NAME Credit?
EOF
;
}else{
print '';
}
print <
Copy the code in the text box and add it to any page on your site.
(will open a new window)
EOF
;
print(admin_html_footer(-List => $list));
}
sub edit_template {
my $root_login = check_list_security(-Admin_List => $admin_list,
-Admin_Password => $admin_password,
-IP_Address => $ENV{REMOTE_ADDR},
-Function => 'edit_template');
my $default_template = default_template($PROGRAM_URL);
unless(defined($process)) {
#set the _list
$list = $admin_list;
my %list_info = open_database(-List => $list);
print(admin_html_header(-Title => "Edit Your Template",
-List => $list_info{list},
-Root_Login => $root_login));
#good job!
print $GOOD_JOB_MESSAGE if(defined($done));
print qq{
$PROGRAM_NAME uses 'psuedo tags' to format its information on a
webpage. These tags are replaced with the information they
represent when shown to your visitors. The psuedo tags
available are at the bottom of this screen.
};
my $cleared_code_template = $default_template;
$cleared_code_template =~ s/</g;
$cleared_code_template =~ s/>/>/g;
$cleared_code_template =~ s/\"/"/g;
print " Use This Information For The Template: ";
print "';
eval { require LWP::Simple; };
if(!@$){
print '
';
print " Use this URL as the template: ";
print $q->textfield(-name => 'url_template', -value => $list_info{url_template}, size=>'65');
}
print qq{
";
print "More ...";
}
print <It's a good idea to periodically check for updates to this script,
as bug fixes and features may be added that you may want to take advantage of:
Visit the support site
An entire support site has been set up just for Dada Mail. There,
you'll be able to browse through faqs, instructions, tips and tricks
and whatever else we can muster:
This mailing list provides information about Skazat Designs and Dada Mail.
It's used to announce new features to Dada Mail, as well as other projects from Skazat Designs.
the list is low traffic and usually e-mails are not sent out more than once a month
Give Back to Dada Mail
Dada Mail is free, open source software, you are in absolutely no obligation to
pay for Dada Mail by downloading or using it. If you find Dada Mail incredibly useful,
you may want to give to the Dada Mail project, money goes towards the cost of
web server hosting for the support site, software used to make this product and to basically
keep the lights on. Any leftover money goes toward my college education.
The Dada Mail Magic Book has been written to give advanced users of Dada Mail
even more insight on the program so they may be able to use Dada Mail to the limit
of its abilities.
Dada Mail is developing rapidly, with many great new features added all the time.
If you need a feature that is not included in Dada Mail, you can always have this feature added by
the developer of Dada Mail. Consultation, Installation and Customization services are available. Please visit:
http://mojo.skazat.com/support/customize.html for more information.
License Agreement
Dada Mail is Open Source Software and is released under the
GNU Public License
Dada Mail and SPAM
Do not use Dada Mail for SPAM. Don't even eat SPAM. Really, it's disgusting.
We're ramen-eatin folks. Seriously though, please read our stance on SPAM: