diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cbb3a13
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.rpm
+*.log
+*spec-20*
+*.tar.gz
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6262ee5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+# Makefile for source rpm: smeserver-phplist
+# $Id: Makefile,v 1.1 2022/08/02 07:05:26 jpp Exp $
+NAME := smeserver-phplist
+SPECFILE = $(firstword $(wildcard *.spec))
+
+define find-makefile-common
+for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
+endef
+
+MAKEFILE_COMMON := $(shell $(find-makefile-common))
+
+ifeq ($(MAKEFILE_COMMON),)
+# attept a checkout
+define checkout-makefile-common
+test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
+endef
+
+MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
+endif
+
+include $(MAKEFILE_COMMON)
diff --git a/README.md b/README.md
index 2bf0a50..6edc583 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,15 @@
-# smeserver-phplist
+# smeserver-phplist
-SMEServer Koozali developed git repo for smeserver-phplist smecontribs
\ No newline at end of file
+SMEServer Koozali developed git repo for smeserver-phplist smecontribs
+
+## Wiki
+
https://wiki.koozali.org/Phplist
+
+## Bugzilla
+Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-phplist&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
+
+## Description
+
+
*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
+*Once it has been checked, then this comment will be deleted*
+
diff --git a/additional/.tito/packages/.readme b/additional/.tito/packages/.readme
new file mode 100644
index 0000000..b9411e2
--- /dev/null
+++ b/additional/.tito/packages/.readme
@@ -0,0 +1,3 @@
+the .tito/packages directory contains metadata files
+named after their packages. Each file has the latest tagged
+version and the project's relative directory.
diff --git a/additional/.tito/packages/smeserver-phplist b/additional/.tito/packages/smeserver-phplist
new file mode 100644
index 0000000..590f726
--- /dev/null
+++ b/additional/.tito/packages/smeserver-phplist
@@ -0,0 +1 @@
+0.2.1-1 ./
diff --git a/additional/.tito/releasers.conf b/additional/.tito/releasers.conf
new file mode 120000
index 0000000..867c32f
--- /dev/null
+++ b/additional/.tito/releasers.conf
@@ -0,0 +1 @@
+../../tito_libs/releasers.conf
\ No newline at end of file
diff --git a/additional/.tito/tito.props b/additional/.tito/tito.props
new file mode 100644
index 0000000..fd87f11
--- /dev/null
+++ b/additional/.tito/tito.props
@@ -0,0 +1,7 @@
+[buildconfig]
+builder = tito.builder.Builder
+tagger = tito.tagger.VersionTagger
+changelog_do_not_remove_cherrypick = 0
+changelog_format = %s (%ae)
+lib_dir = ../tito_libs
+
diff --git a/additional/smeserver-phplist.spec b/additional/smeserver-phplist.spec
new file mode 100644
index 0000000..adfb230
--- /dev/null
+++ b/additional/smeserver-phplist.spec
@@ -0,0 +1,87 @@
+Summary: sme server integration of phplist
+Name: smeserver-phplist
+Version: 0.2.1
+Release: 1%{?dist}
+License: GNU GPL version 2
+URL: http://www.phplist.com
+Group: SMEserver/addon
+Source: %{name}-%{version}.tar.gz
+
+BuildArchitectures: noarch
+BuildRequires: e-smith-devtools
+BuildRoot: /var/tmp/%{name}-%{version}
+Requires: e-smith-release >= 8.0
+Requires: phplist >= 3.0.6
+Requires: smeserver-webapps-common
+AutoReqProv: no
+
+%description
+This rpm provides all the needed templates to get phplist
+running on SME Server
+
+%changelog
+* Wed Mar 18 2020 Daniel Berteaud 0.2.1-1
+- new package built with tito
+
+* Wed Jul 30 2014 Daniel Berteaud 0.2.0-1
+- Nearly complete rewrite
+- Change the way bounces are processed
+- Add a daemon to process the queue and the bounces
+- Requires phplist 3.0.6
+
+* Fri Dec 31 2010 Daniel Berteaud 0.1-3
+- Fix typo in BouncesPassword prop name
+
+* Thu Dec 30 2010 Daniel Berteaud 0.1-2
+- Change the way mysql permissions are applied
+- Rewrite URL to force SSL for /lists/admin
+- Add LemonLDAP auth support (disable basic auth)
+- Add AdminUsers prop (only for basic auth)
+
+* Mon Dec 20 2010 Daniel Berteaud 0.1-1
+- Minor templates cleanup
+
+* Mon Dec 20 2010 Pierre Bourdin 0.1-0.beta9
+- patch to restrict admin interface with SSL + login
+- Separation of the main Alias for Apache in two parts, Admin and Subscibe part
+
+* Mon Dec 20 2010 Pierre Bourdin 0.1-0.beta8
+- patch for force SSL connection and add access variable in DB configuration
+
+* Thu Dec 09 2010 Pierre Bourdin 0.1-0.beta2
+- patch some forgotten parameters in configuration files and add DB configuration
+
+* Wed Dec 08 2010 Pierre Bourdin 0.1-0.beta0
+- initial release
+
+
+%prep
+%setup
+
+%build
+perl ./createlinks
+%{__mkdir_p} root/var/lib/phplist
+%{__mkdir_p} root/var/log/phplist
+
+%install
+rm -rf $RPM_BUILD_ROOT
+(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
+rm -f %{name}-%{version}-filelist
+/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
+ --dir /var/lib/phplist 'attr(0750,www,www)' \
+ --dir /var/log/phplist 'attr(0750,smelog,smelog)' \
+ --file /var/lib/phplist/bounces.mbox 'config(noreplace) %attr(0640,www,www)' \
+ --file /var/service/phplist/run 'attr(0750,root,root)' \
+ --file /var/service/phplist/log/run 'attr(0750,root,root)' \
+ > %{name}-%{version}-filelist
+
+%files -f %{name}-%{version}-filelist
+%defattr(-,root,root)
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%postun
+
+true
+
diff --git a/contriborbase b/contriborbase
new file mode 100644
index 0000000..9b7fd51
--- /dev/null
+++ b/contriborbase
@@ -0,0 +1 @@
+contribs10
diff --git a/createlinks b/createlinks
new file mode 100644
index 0000000..e85d8d6
--- /dev/null
+++ b/createlinks
@@ -0,0 +1,51 @@
+#!/usr/bin/perl -w
+
+use esmith::Build::CreateLinks qw(:all);
+
+templates2events("/etc/e-smith/sql/init/phplistdb", qw/webapps-update bootstrap-console-save/);
+templates2events("/etc/phplist/config.php", qw/webapps-update bootstrap-console-save/);
+
+safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/webapps-update/S55phplist-qmail-assign");
+foreach my $event (qw/webapps-update bootstrap-ldap-save/){
+ event_link("phplist-create-pseudo", "$event", "55");
+}
+
+safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/phplist/config.php/template-begin");
+safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/phplist/config.php/template-end");
+
+safe_symlink("/var/qmail/alias/.qmail-phplistbounces", "root/var/qmail/alias/.qmail-phplistbounces-default");
+
+safe_symlink("restart", "root/etc/e-smith/events/webapps-update/services2adjust/phplist");
+
+
+safe_touch("root/var/lib/phplist/bounces.mbox");
+
+my $event="smeserver-phplist-update";
+event_templates($event, qw(
+/etc/httpd/conf/httpd.conf
+/etc/opt/remi/php80/php-fpm.d/www.conf
+/etc/e-smith/sql/init/phplistdb
+/etc/phplist/config.php
+/etc/e-smith/sql/init/phplistdb
+));
+
+event_services($event, qw(
+ php80-php-fpm restart
+ httpd-e-smith restart
+ phplist restart
+ mysql.init restart
+));
+safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S93phplist-qmail-assign");
+
+event_actions($event, qw(
+ phplist-initialise 92
+ phplist-create-pseudo 93
+ systemd-default 88
+ systemd-reload 89
+));
+
+use esmith::Build::Backup qw(:all);
+backup_includes("smeserver-phplist-udpdate", qw(
+/var/lib/phplist
+/var/log/phplist
+));
diff --git a/root/etc/e-smith/db/accounts/defaults/lists/type b/root/etc/e-smith/db/accounts/defaults/lists/type
new file mode 100644
index 0000000..96cdd3b
--- /dev/null
+++ b/root/etc/e-smith/db/accounts/defaults/lists/type
@@ -0,0 +1 @@
+url
diff --git a/root/etc/e-smith/db/configuration/defaults/phplist/DbName b/root/etc/e-smith/db/configuration/defaults/phplist/DbName
new file mode 100644
index 0000000..ae306e4
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/phplist/DbName
@@ -0,0 +1 @@
+phplist
diff --git a/root/etc/e-smith/db/configuration/defaults/phplist/DbUser b/root/etc/e-smith/db/configuration/defaults/phplist/DbUser
new file mode 100644
index 0000000..ae306e4
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/phplist/DbUser
@@ -0,0 +1 @@
+phplist
diff --git a/root/etc/e-smith/db/configuration/defaults/phplist/access b/root/etc/e-smith/db/configuration/defaults/phplist/access
new file mode 100644
index 0000000..3e18ebf
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/phplist/access
@@ -0,0 +1 @@
+private
diff --git a/root/etc/e-smith/db/configuration/defaults/phplist/status b/root/etc/e-smith/db/configuration/defaults/phplist/status
new file mode 100644
index 0000000..86981e6
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/phplist/status
@@ -0,0 +1 @@
+enabled
diff --git a/root/etc/e-smith/db/configuration/defaults/phplist/type b/root/etc/e-smith/db/configuration/defaults/phplist/type
new file mode 100644
index 0000000..24e1098
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/phplist/type
@@ -0,0 +1 @@
+service
diff --git a/root/etc/e-smith/db/configuration/migrate/phplist-database b/root/etc/e-smith/db/configuration/migrate/phplist-database
new file mode 100644
index 0000000..fe4d943
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/migrate/phplist-database
@@ -0,0 +1,52 @@
+{
+ my $rec = $DB->get('phplist')
+ || $DB->new_record('phplist', {type => 'webapp'});
+ my $pw = $rec->prop('DbPassword');
+ if (not $pw or length($pw) < 57){
+ use MIME::Base64 qw(encode_base64);
+
+ $pw = "not set due to error";
+ if ( open( RANDOM, "/dev/urandom" ) ){
+ my $buf;
+ # 57 bytes is a full line of Base64 coding, and contains
+ # 456 bits of randomness - given a perfectly random /dev/random
+ if ( read( RANDOM, $buf, 57 ) != 57 ){
+ warn("Short read from /dev/random: $!");
+ }
+ else{
+ $pw = encode_base64($buf);
+ chomp $pw;
+ }
+ close RANDOM;
+ }
+ else{
+ warn "Could not open /dev/urandom: $!";
+ }
+ $rec->set_prop('DbPassword', $pw);
+ }
+ my $apw = $rec->prop('AdminPass');
+ if (not $apw or length($apw) < 20){
+ use MIME::Base64 qw(encode_base64);
+ $apw = "not set due to error";
+ if ( open( RANDOM, "/dev/urandom" ) ){
+ my $buf;
+ # 57 bytes is a full line of Base64 coding, and contains
+ # 456 bits of randomness - given a perfectly random /dev/random
+ if ( read( RANDOM, $buf, 20 ) != 20 ){
+ warn("Short read from /dev/random: $!");
+ }
+ else{
+ $apw = encode_base64($buf);
+ chomp $apw;
+ }
+ close RANDOM;
+ }
+ else{
+ warn "Could not open /dev/urandom: $!";
+ }
+ $rec->set_prop('AdminPass', $apw);
+ }
+ my $type = $rec->prop("type");
+ $rec->set_prop("type","service") unless ($type eq "service");
+
+}
diff --git a/root/etc/e-smith/events/actions/phplist-create-pseudo b/root/etc/e-smith/events/actions/phplist-create-pseudo
new file mode 100644
index 0000000..5f9bc7c
--- /dev/null
+++ b/root/etc/e-smith/events/actions/phplist-create-pseudo
@@ -0,0 +1,20 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use esmith::AccountsDB;
+
+my $a = esmith::AccountsDB->open or die "Couldn't open AccountsDB\n";
+
+my $pseudo = $a->get('listreports');
+
+if (!$pseudo){
+ $a->new_record('listreports',{
+ type => 'pseudonym',
+ Account => 'admin'
+ });
+ unless ( system("/sbin/e-smith/signal-event", "pseudonym-create", "listreports") == 0 ){
+ die "Failed to create pseudonym listreports\n";
+ }
+}
+
diff --git a/root/etc/e-smith/events/actions/phplist-initialise b/root/etc/e-smith/events/actions/phplist-initialise
new file mode 100644
index 0000000..db051ff
--- /dev/null
+++ b/root/etc/e-smith/events/actions/phplist-initialise
@@ -0,0 +1,6 @@
+#!/bin/bash
+password=$(config getprop phplist AdminPass)
+domain=$(config get DomainName)
+ADMIN_PASSWORD=$password ADMIN_EMAIL=admin@$domain phplist -pinitialise
+phplist -pdbcheck
+phplist -pupgrade
diff --git a/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/phplistdb b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/phplistdb
new file mode 100644
index 0000000..940dcf3
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/phplistdb
@@ -0,0 +1 @@
+PERMS=0750
diff --git a/root/etc/e-smith/templates.metadata/etc/phplist/config.php b/root/etc/e-smith/templates.metadata/etc/phplist/config.php
new file mode 100644
index 0000000..bad4258
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/etc/phplist/config.php
@@ -0,0 +1,3 @@
+PERMS=0640
+UID="root"
+GID="www"
diff --git a/root/etc/e-smith/templates/etc/e-smith/sql/init/phplistdb b/root/etc/e-smith/templates/etc/e-smith/sql/init/phplistdb
new file mode 100644
index 0000000..c2d2229
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/e-smith/sql/init/phplistdb
@@ -0,0 +1,46 @@
+{
+my $db = ${'phplist'}{'DbName'} || 'phplist';
+my $user = ${'phplist'}{'DbUser'} || 'phplist';
+my $pass = ${'phplist'}{'DbPassword'} || 'secret';
+
+$OUT .= <<"END";
+
+#! /bin/sh
+if [ ! -d /var/lib/mysql/$db ]; then
+ /usr/bin/mysql -e 'create database $db'
+fi
+
+
+/usr/bin/mysql <
+ Options None +FollowSymLinks
+ AllowOverride None
+ DirectoryIndex index.php
+ AddType application/x-httpd-php .php
+
+ Require all denied
+
+
+ Require all granted
+ SetHandler "proxy:unix:/var/run/php-fpm/php80-phplist.sock|fcgi://localhost"
+
+ Require $allow
+
+
+# Admin section
+
+ SSLRequireSSL on
+
+ Require all denied
+
+
+ SetHandler "proxy:unix:/var/run/php-fpm/php80-phplist.sock|fcgi://localhost"
+ Require all granted
+
+ SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=\$1
+
+ Require $allow
+ $auth
+
+
+
+
+
+ Require $allow
+
+
+
+
+
+ Require $allow
+
+
+
+EOF
+}
+else{
+ $OUT .= "# PHPList is disabled\n";
+}
+}
diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/60PhplistSSL b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/60PhplistSSL
new file mode 100644
index 0000000..e163a41
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/60PhplistSSL
@@ -0,0 +1,13 @@
+{
+my $sslport = $modSSL{'TCPPort'} || '443';
+my $alias = $phplist{'AliasOnPrimary'} || 'enabled';
+
+if ($port ne $sslport && $alias eq 'enabled'){
+
+ ## Redirect Web Address to Secure Address
+ $OUT .= " RewriteEngine on\n";
+ $OUT .= " RewriteRule ^/lists/admin(/.*|\$) https://%{HTTP_HOST}/lists/admin\$1 \[L,R\]\n";
+
+}
+}
+
diff --git a/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist b/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist
new file mode 100644
index 0000000..521f0a2
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist
@@ -0,0 +1,66 @@
+{
+
+if ($PHP_VERSION eq '80'){
+ if (($phplist{'status'} || 'disabled') eq 'enabled'){
+ my $max_upload_size = ($phplist{MaxUploadSize} || '6M');
+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
+ my $memory_limit = ($phplist{MemoryLimit} || '128M');
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
+ my $open_basedir= $phplist{PHPBaseDir} || '';
+ $open_basedir = "/usr/share/phplist:/var/lib/phplist:/tmp:/etc/phplist:/var/log/phplist:/usr/share/php/auth_translation.php:$open_basedir";
+ my $id = 'phplist';
+ my $max_children = $phplist{'PHPmaxChildren'} || 20;
+ my $min_spare_servers = $phplist{'PHPminServers'} || 4;
+ my $start_servers = $phplist{'PHPstartServers'} || 6;
+ my $max_spare_servers = $phplist{'PHPmaxServers'} || 8;
+ my $max_requests = $phplist{'PHPmaxRequests'} || 1000;
+ $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
+ $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
+
+ $OUT .=<<_EOF;
+
+[php$PHP_VERSION-$id]
+user = www
+group = www
+listen.owner = root
+listen.group = www
+listen.mode = 0660
+listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
+pm = dynamic
+pm.max_children = $max_children
+pm.start_servers = $start_servers
+pm.min_spare_servers = $min_spare_servers
+pm.max_spare_servers = $max_spare_servers
+pm.max_requests = $max_requests
+php_admin_value[auto_prepend_file] = /usr/share/php/auth_translation.php
+php_admin_value[session.save_path] = /var/lib/php/$id/session
+php_admin_value[session.gc_maxlifetime] = 86400
+php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
+php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
+php_admin_value[error_log] = /var/log/php/$id/error.log
+slowlog = /var/log/php/phplist/slow.log
+php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
+php_admin_flag[display_errors] = off
+php_admin_flag[log_errors] = on
+php_admin_value[error_log] = syslog
+php_admin_value[memory_limit] = $memory_limit
+php_admin_value[max_execution_time] = 3600
+php_admin_value[post_max_size] = $max_upload_size
+php_admin_value[upload_max_filesize] = $max_upload_size
+php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd
+php_admin_value[open_basedir] = $open_basedir
+php_admin_flag[allow_url_fopen] = on
+php_admin_flag[file_uploads] = on
+php_admin_flag[session.cookie_httponly] = on
+php_admin_flag[allow_url_include] = off
+php_admin_value[session.save_handler] = files
+php_admin_flag[output_buffering] = off
+
+_EOF
+
+ }
+ else{
+ $OUT .= '; phplist is disabled';
+ }
+}
+}
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/10Database b/root/etc/e-smith/templates/etc/phplist/config.php/10Database
new file mode 100644
index 0000000..689be09
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/10Database
@@ -0,0 +1,15 @@
+{
+
+my $dbn = $phplist{'DbName'} || 'phplist';
+my $dbu = $phplist{'DbUser'} || 'phplist';
+my $dbp = $phplist{'DbPassword'} || 'secret';
+
+$OUT .=<<"HERE";
+
+\$database_host = "localhost";
+\$database_name = "$dbn";
+\$database_user = "$dbu";
+\$database_password = '$dbp';
+
+HERE
+}
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/15Smtp b/root/etc/e-smith/templates/etc/phplist/config.php/15Smtp
new file mode 100644
index 0000000..c70ad23
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/15Smtp
@@ -0,0 +1 @@
+define("PHPMAILERHOST",'localhost');
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/20Test b/root/etc/e-smith/templates/etc/phplist/config.php/20Test
new file mode 100644
index 0000000..0f46f10
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/20Test
@@ -0,0 +1 @@
+define ("TEST",0);
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/25Bounces b/root/etc/e-smith/templates/etc/phplist/config.php/25Bounces
new file mode 100644
index 0000000..7882a99
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/25Bounces
@@ -0,0 +1,7 @@
+$message_envelope = "phplistbounces@{$DomainName}";
+$bounce_protocol = 'mbox';
+define ("MANUALLY_PROCESS_BOUNCES",0);
+$bounce_mailbox = '/var/lib/phplist/bounces.mbox';
+$bounce_mailbox_purge = 1;
+$bounce_mailbox_purge_unprocessed = 1;
+$bounce_unsubscribe_threshold = 5;
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/30InstallName b/root/etc/e-smith/templates/etc/phplist/config.php/30InstallName
new file mode 100644
index 0000000..88506dc
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/30InstallName
@@ -0,0 +1 @@
+$installation_name = 'phpList {$DomainName}';
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/35Login b/root/etc/e-smith/templates/etc/phplist/config.php/35Login
new file mode 100644
index 0000000..fbc54de
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/35Login
@@ -0,0 +1,9 @@
+$require_login = 1;
+$admin_auth_module = '{(($phplist{'Authentication'} || 'internal') eq 'internal') ? 'phplist_auth.inc':'external_auth.inc'}';
+define("REGISTER",0);
+define("MANUALLY_PROCESS_QUEUE",0);
+define('MAILQUEUE_THROTTLE',0.5);
+define('USE_DOMAIN_THROTTLE',0);
+define('DOMAIN_BATCH_SIZE',30);
+define('DOMAIN_BATCH_PERIOD',300);
+define('MAX_PROCESSQUEUE_TIME',900);
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/40Tracking b/root/etc/e-smith/templates/etc/phplist/config.php/40Tracking
new file mode 100644
index 0000000..421a77a
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/40Tracking
@@ -0,0 +1,12 @@
+{
+if (($phplist{'Tracking'} || 'disabled') eq 'enabled'){
+ $OUT .=<<"EOF";
+define('CLICKTRACK',1);
+define('CLICKTRACK_SHOWDETAIL',1);
+EOF
+}
+else{
+ $OUT .= '# Tracking is disabled';
+}
+}
+define("NOSTATSCOLLECTION",1);
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/45Queue b/root/etc/e-smith/templates/etc/phplist/config.php/45Queue
new file mode 100644
index 0000000..3f7a373
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/45Queue
@@ -0,0 +1,3 @@
+define("MANUALLY_PROCESS_QUEUE",0);
+define('MAILQUEUE_THROTTLE',0);
+define('USE_DOMAIN_THROTTLE',0);
diff --git a/root/etc/e-smith/templates/etc/phplist/config.php/50Options b/root/etc/e-smith/templates/etc/phplist/config.php/50Options
new file mode 100644
index 0000000..f09c5bb
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/phplist/config.php/50Options
@@ -0,0 +1,15 @@
+$attachment_repository = '/var/lib/phplist/tmp';
+define("ALLOW_ATTACHMENTS",1);
+define('USE_ADMIN_DETAILS_FOR_MESSAGES',1);
+define("PLUGIN_ROOTDIR","/usr/share/phplist/www/admin/plugins");
+define("FCKIMAGES_DIR","uploadimages");
+define('UPLOADIMAGES_DIR','uploadimages');
+define("FORWARD_PERSONAL_NOTE_SIZE",500);
+$tmpdir = '/var/lib/phplist/tmp';
+{
+ my $lang = $phplist{'Language'} || '';
+ $lang .= ($lang =~ m/\.inc$/) ? '' : '.inc';
+ if ($lang ne '' && -e '/usr/share/phplist/www/texts/' . $lang){
+ $OUT .= '$language_module = \'' . $lang . '\';';
+ }
+}
diff --git a/root/etc/e-smith/templates/var/qmail/users/assign/90phplist b/root/etc/e-smith/templates/var/qmail/users/assign/90phplist
new file mode 100644
index 0000000..b79d147
--- /dev/null
+++ b/root/etc/e-smith/templates/var/qmail/users/assign/90phplist
@@ -0,0 +1,2 @@
+=phplistbounces:www:102:102:/var/qmail/alias:-:phplistbounces:
++phplistbounces-:www:102:102:/var/qmail/alias:-:-phplistbounces-::
diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/goodrcptto/80phplist b/root/etc/e-smith/templates/var/service/qpsmtpd/config/goodrcptto/80phplist
new file mode 100644
index 0000000..6394843
--- /dev/null
+++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/goodrcptto/80phplist
@@ -0,0 +1,3 @@
+{
+ $OUT .= "phplistbounces\@$_\n" for (@domains);
+}
diff --git a/root/usr/lib/systemd/system/phplist.service b/root/usr/lib/systemd/system/phplist.service
new file mode 100644
index 0000000..cbdf84d
--- /dev/null
+++ b/root/usr/lib/systemd/system/phplist.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=phplist process queues
+After=network-online.target
+
+[Service]
+ExecStartPre=-/sbin/e-smith/service-status phplist
+ExecStart=/usr/sbin/e-smith/systemd/phplist
+Restart=always
+Restartsec=10s
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sme-server.target
diff --git a/root/usr/local/bin/phplist b/root/usr/local/bin/phplist
new file mode 100644
index 0000000..f8672fc
--- /dev/null
+++ b/root/usr/local/bin/phplist
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/bin/php80 /usr/share/phplist/www/admin/index.php -c /etc/phplist/config.php $*
diff --git a/root/usr/sbin/e-smith/systemd/phplist b/root/usr/sbin/e-smith/systemd/phplist
new file mode 100644
index 0000000..b9e4272
--- /dev/null
+++ b/root/usr/sbin/e-smith/systemd/phplist
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+exec 2>&1
+
+cd /usr/local/bin/
+while true; do
+ /usr/local/bin/setuidgid www ./phplist -pprocessbounces
+ /usr/local/bin/setuidgid www ./phplist -pprocessqueue
+ sleep 120
+done
diff --git a/root/usr/share/phplist/www/admin/auth/external_auth.inc b/root/usr/share/phplist/www/admin/auth/external_auth.inc
new file mode 100644
index 0000000..944fc84
--- /dev/null
+++ b/root/usr/share/phplist/www/admin/auth/external_auth.inc
@@ -0,0 +1,119 @@
+
diff --git a/root/var/qmail/alias/.qmail-phplistbounces b/root/var/qmail/alias/.qmail-phplistbounces
new file mode 100644
index 0000000..059c3f6
--- /dev/null
+++ b/root/var/qmail/alias/.qmail-phplistbounces
@@ -0,0 +1 @@
+/var/lib/phplist/bounces.mbox
diff --git a/smeserver-phplist.spec b/smeserver-phplist.spec
new file mode 100644
index 0000000..d891064
--- /dev/null
+++ b/smeserver-phplist.spec
@@ -0,0 +1,111 @@
+Summary: sme server integration of phplist
+Name: smeserver-phplist
+Version: 0.2.1
+Release: 4%{?dist}
+License: GNU GPL version 2
+URL: http://www.phplist.com
+Group: SMEserver/addon
+Source: %{name}-%{version}.tar.xz
+
+BuildArchitectures: noarch
+BuildRequires: e-smith-devtools
+BuildRoot: /var/tmp/%{name}-%{version}
+Requires: e-smith-release >= 10.0
+Requires: e-smith-apache >= 2.6.0-19
+Requires: phplist >= 3.6.8
+Requires: smeserver-webapps-common
+Requires: php80-php php80-php-mysqli php80-php-mysqlnd php80-php-pecl-mysql php80-php-curl php80-php-gd php80-php-gettext php80-php-iconv php80-php-imap php80-php-mbstring php80-php-mysqli php80-php-session php80-php-xml php80-php-zlib php80-php-mbstring php80-php-gd
+#php80-php-pear-HTTP_Request
+AutoReqProv: no
+
+%description
+This rpm provides all the needed templates to get phplist
+running on SME Server
+
+%changelog
+* Sat Sep 07 2024 cvs2git.sh aka Brian Read 0.2.1-4.sme
+- Roll up patches and move to git repo [SME: 12338]
+
+* Sat Sep 07 2024 BogusDateBot
+- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
+ by assuming the date is correct and changing the weekday.
+
+* Wed Aug 03 2022 Jean-Philippe Pialasse 0.2.1-3.sme
+- make http auth not the default.
+
+* Tue Aug 02 2022 Jean-Philippe Pialasse 0.2.1-2.sme
+- ported to SME10
+
+* Wed Mar 18 2020 Daniel Berteaud 0.2.1-1
+- new package built with tito
+
+* Wed Jul 30 2014 Daniel Berteaud 0.2.0-1
+- Nearly complete rewrite
+- Change the way bounces are processed
+- Add a daemon to process the queue and the bounces
+- Requires phplist 3.0.6
+
+* Fri Dec 31 2010 Daniel Berteaud 0.1-3
+- Fix typo in BouncesPassword prop name
+
+* Thu Dec 30 2010 Daniel Berteaud 0.1-2
+- Change the way mysql permissions are applied
+- Rewrite URL to force SSL for /lists/admin
+- Add LemonLDAP auth support (disable basic auth)
+- Add AdminUsers prop (only for basic auth)
+
+* Mon Dec 20 2010 Daniel Berteaud 0.1-1
+- Minor templates cleanup
+
+* Mon Dec 20 2010 Pierre Bourdin 0.1-0.beta9
+- patch to restrict admin interface with SSL + login
+- Separation of the main Alias for Apache in two parts, Admin and Subscibe part
+
+* Mon Dec 20 2010 Pierre Bourdin 0.1-0.beta8
+- patch for force SSL connection and add access variable in DB configuration
+
+* Thu Dec 09 2010 Pierre Bourdin 0.1-0.beta2
+- patch some forgotten parameters in configuration files and add DB configuration
+
+* Wed Dec 08 2010 Pierre Bourdin 0.1-0.beta0
+- initial release
+
+
+%prep
+%setup
+rm -rf root/var/service/
+
+%build
+perl ./createlinks
+%{__mkdir_p} root/var/lib/php/phplist/{tmp,opcache,session}
+%{__mkdir_p} root/var/log/phplist
+%{__mkdir_p} root/var/log/php/phplist
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
+rm -f %{name}-%{version}-filelist
+/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
+ --dir /var/lib/phplist 'attr(0750,www,www)' \
+ --dir /var/log/phplist 'attr(0750,smelog,smelog)' \
+ --file /var/lib/phplist/bounces.mbox 'config(noreplace) %attr(0640,www,www)' \
+ --file /usr/sbin/e-smith/systemd/phplist 'attr(0750,root,root)' \
+ --dir /var/lib/php/phplist 'attr(0755,www,www)' \
+ --dir /var/lib/php/phplist/tmp 'attr(0755,www,www)' \
+ --dir /var/lib/php/phplist/opcache 'attr(0755,www,www)' \
+ --dir /var/lib/php/phplist/session 'attr(0755,www,www)' \
+ --ignoredir /var/qmail/alias --ignoredir /var/lib/phplist \
+ --file /usr/local/bin/phplist 'attr(0750,root,www)' \
+ > %{name}-%{version}-filelist
+
+%files -f %{name}-%{version}-filelist
+%defattr(-,root,root)
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%postun
+
+true
+