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..d8b35c6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+# Makefile for source rpm: smeserver-autodiscover
+# $Id: Makefile,v 1.1 2022/07/13 21:19:56 jpp Exp $
+NAME := smeserver-autodiscover
+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 85c306e..0209b43 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,15 @@
-# smeserver-autodiscover
+# smeserver-autodiscover
-SMEServer Koozali developed git repo for smeserver-autodiscover smecontribs
\ No newline at end of file
+SMEServer Koozali developed git repo for smeserver-autodiscover smecontribs
+
+## Wiki
+
https://wiki.koozali.org/Autodiscover
+
+## Bugzilla
+Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-autodiscover&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/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..4fbc3a1
--- /dev/null
+++ b/createlinks
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+use strict;
+use esmith::Build::CreateLinks qw(:all);
+
+my $pkg= "smeserver-autodiscover";
+my $event = "${pkg}-update";
+
+#event_actions($event, qw(
+# systemd-default 88
+# systemd-reload 89
+#));
+
+event_templates($event, qw(
+ /var/www/Autodiscover/Mozilla.php
+ /var/www/Autodiscover/Autodiscover.php
+ /etc/httpd/conf/httpd.conf
+));
+
+event_services($event, qw(
+ httpd-e-smith reload-or-restart
+));
+
+#email-update
+$event ="email-update";
+event_templates($event, qw(
+ /var/www/Autodiscover/Mozilla.php
+ /var/www/Autodiscover/Autodiscover.php
+));
+
+
+#webapps-update
+$event ="webapps-update";
+event_templates($event, qw(
+ /var/www/Autodiscover/Mozilla.php
+ /var/www/Autodiscover/Autodiscover.php
+));
+
+#remoteaccess-update
+$event ="remoteaccess-update";
+event_templates($event, qw(
+ /var/www/Autodiscover/Mozilla.php
+ /var/www/Autodiscover/Autodiscover.php
+));
+
+
+
+#use esmith::Build::Backup qw(:all);
+#backup_includes($pkg, qw( ));
+
diff --git a/root/etc/e-smith/db/configuration/defaults/autodiscover/access b/root/etc/e-smith/db/configuration/defaults/autodiscover/access
new file mode 100644
index 0000000..a48cf0d
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/autodiscover/access
@@ -0,0 +1 @@
+public
diff --git a/root/etc/e-smith/db/configuration/defaults/autodiscover/status b/root/etc/e-smith/db/configuration/defaults/autodiscover/status
new file mode 100644
index 0000000..86981e6
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/autodiscover/status
@@ -0,0 +1 @@
+enabled
diff --git a/root/etc/e-smith/db/configuration/defaults/autodiscover/type b/root/etc/e-smith/db/configuration/defaults/autodiscover/type
new file mode 100644
index 0000000..f92f363
--- /dev/null
+++ b/root/etc/e-smith/db/configuration/defaults/autodiscover/type
@@ -0,0 +1 @@
+configuration
diff --git a/root/etc/e-smith/templates.metadata/var/www/Autodiscover/Autodiscover.php b/root/etc/e-smith/templates.metadata/var/www/Autodiscover/Autodiscover.php
new file mode 100644
index 0000000..7d87103
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/var/www/Autodiscover/Autodiscover.php
@@ -0,0 +1,3 @@
+PERMS=0640
+UID="www"
+GID="www"
diff --git a/root/etc/e-smith/templates.metadata/var/www/Autodiscover/Mozilla.php b/root/etc/e-smith/templates.metadata/var/www/Autodiscover/Mozilla.php
new file mode 100644
index 0000000..7d87103
--- /dev/null
+++ b/root/etc/e-smith/templates.metadata/var/www/Autodiscover/Mozilla.php
@@ -0,0 +1,3 @@
+PERMS=0640
+UID="www"
+GID="www"
diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/79Autodiscover b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/79Autodiscover
new file mode 100644
index 0000000..b58b633
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/79Autodiscover
@@ -0,0 +1,10 @@
+
+{
+ $OUT = ( ($autodiscover || "public") eq "public" ) ? " Require all granted\n Allow from all\n" : " Require ip $localAccess $externalSSLAccess\n Allow from all $localAccess $externalSSLAccess\n ";
+}
+
+
+ SetHandler "proxy:unix:/var/run/php-fpm/php80.sock|fcgi://localhost"
+
+
+
diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28autodiscover b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28autodiscover
new file mode 100644
index 0000000..17732fc
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28autodiscover
@@ -0,0 +1,18 @@
+{
+return "# autodiscover disabled\n" unless $autodiscover{'status'} eq "enabled";
+
+ if ($port eq $httpsPort)
+ {
+ $OUT .= 'Alias /autodiscover/autodiscover.xml "/var/www/Autodiscover/Autodiscover.php"'."\n";
+ $OUT .= 'Alias /Autodiscover/Autodiscover.xml "/var/www/Autodiscover/Autodiscover.php"'."\n";
+ $OUT .= 'Alias /AutoDiscover/AutoDiscover.xml "/var/www/Autodiscover/Autodiscover.php"'."\n";
+ $OUT .= 'Alias /.well-known/autoconfig/mail/config-v1.1.xml "/var/www/Autodiscover/Mozilla.php"'."\n";
+ }
+ else
+ {
+ $OUT .= 'RedirectMatch 302 ^/\.well-known/autoconfig/mail/config-v1\.1\.xml(.*|$) https://%{HTTP_HOST}/.well-known/autoconfig/mail/config-v1.1.xml$1 '."\n";
+ $OUT .= 'RedirectMatch 302 ^/(a|A)utodiscover(/.*|$) https://%{HTTP_HOST}/autodiscover$2 '."\n";
+ }
+
+
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/05user b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/05user
new file mode 100644
index 0000000..65275fb
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/05user
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/10Account b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/10Account
new file mode 100644
index 0000000..00213ee
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/10Account
@@ -0,0 +1,3 @@
+
+ email
+ settings
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/15IMAP b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/15IMAP
new file mode 100644
index 0000000..e49a97e
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/15IMAP
@@ -0,0 +1,16 @@
+{
+return "" unless $imaps{'status'} eq "enabled";
+$OUT=<<'string_ending_delimiter';
+
+
+ IMAP
+
+ 993
+ off
+ on
+ on
+
+
+
+string_ending_delimiter
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/20POP b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/20POP
new file mode 100644
index 0000000..dd3c473
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/20POP
@@ -0,0 +1,16 @@
+{
+return "" if $imaps{'status'} eq "enabled";
+return "" unless $pop3s{'status'} eq "enabled";
+$OUT=<<'string_ending_delimiter';
+
+ POP3
+
+ 995
+ off
+ on
+ on
+
+
+
+string_ending_delimiter
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/30SMTP b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/30SMTP
new file mode 100644
index 0000000..33527a9
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/30SMTP
@@ -0,0 +1,30 @@
+{
+$OUT=<<'string_ending_delimiter';
+
+ SMTP
+
+ 25
+ off
+ TLS
+ on
+ on
+
+
+
+string_ending_delimiter
+
+#if we start support for port 587 submisison we would need to alter this
+return $OUT unless $sqpsmtpd{'status'} eq "enabled";
+$OUT=<<'string_ending_delimiter';
+
+ SMTP
+
+ 465
+ off
+ on
+ on
+
+
+
+string_ending_delimiter
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/35AccountEnd b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/35AccountEnd
new file mode 100644
index 0000000..2991e95
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/35AccountEnd
@@ -0,0 +1 @@
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/template-begin b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/template-begin
new file mode 100644
index 0000000..e5b0e6c
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/template-begin
@@ -0,0 +1,19 @@
+(.*)<\/EMailAddress>/', $raw, $matches);
+ if (isset($matches[1])) \{
+ $LoginName = "".$matches[1]."";
+ \}
+ $email = array_key_exists('email', $_GET) ? $_GET['email'] : null;
+ $email = filter_var($email, FILTER_VALIDATE_EMAIL);
+ if (array_key_exists('email', $_GET)) \{
+ $LoginName = "".$email."";
+ \}
+ header('Content-Type: application/xml');
+?>
+"; ?>
+
+
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/template-end b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/template-end
new file mode 100644
index 0000000..80e78df
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Autodiscover.php/template-end
@@ -0,0 +1,2 @@
+
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/10EmailProvider b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/10EmailProvider
new file mode 100644
index 0000000..eacc1bb
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/10EmailProvider
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/15IMAP b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/15IMAP
new file mode 100644
index 0000000..0147150
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/15IMAP
@@ -0,0 +1,20 @@
+{
+return " \n" if $imaps{'status'} eq "disabled" && $imap{'access'} eq "localhost";
+$port=$imaps{'TCPPort'} || '993';
+$socket="SSL";
+
+if ($imaps{'status'} eq "disabled") {
+ $port=$qpsmtpd{'TCPPort'} || '143';
+ $socket="STARTTLS";
+}
+
+$OUT=<<"string_ending_delimiter";
+
+
+ $port
+ $socket
+ \%EMAILLOCALPART\%
+ password-cleartext
+
+string_ending_delimiter
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/20POP3 b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/20POP3
new file mode 100644
index 0000000..081d3cc
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/20POP3
@@ -0,0 +1,26 @@
+{
+return " \n" if $pop3s{'status'} eq "disabled" && $pop3s{'status'} eq "disabled";
+$port=$pop3s{'TCPPort'} || '995';
+$socket="SSL";
+
+if ($pop3s{'status'} eq "disabled" && $pop3{'status'} eq "enabled") {
+ $port=$pop3{'TCPPort'} || '25';
+ $socket="STARTTLS";
+}
+
+$OUT=<<"string_ending_delimiter";
+
+
+ $port
+ $socket
+ \%EMAILLOCALPART\%
+ password-cleartext
+
+ true
+ true
+ 14
+
+
+
+string_ending_delimiter
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/50SMTP b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/50SMTP
new file mode 100644
index 0000000..7ca159f
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/50SMTP
@@ -0,0 +1,23 @@
+{
+return " " if $sqpsmtpd{'status'} eq "disabled" && $qpsmtpd{'status'} eq "disabled";
+$port=$sqpsmtpd{'TCPPort'} || '465';
+$socket="SSL";
+
+if ($sqpsmtpd{'status'} eq "disabled") {
+ $port=$qpsmtpd{'TCPPort'} || '25';
+ $socket="STARTTLS";
+}
+
+$OUT=<<"string_ending_delimiter";
+
+
+ $port
+ $socket
+ \%EMAILLOCALPART\%
+ password-cleartext
+
+ true
+ true
+
+string_ending_delimiter
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/60Identity b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/60Identity
new file mode 100644
index 0000000..1fcc915
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/60Identity
@@ -0,0 +1,8 @@
+{
+#
+#
+#
+#
+$OUT = "";
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/65Documentation b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/65Documentation
new file mode 100644
index 0000000..6d4b94a
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/65Documentation
@@ -0,0 +1,22 @@
+{
+#
+$docpath=$autodiscover{'DocURL'} || "undef";
+return "" if $docpath eq "undef";
+$OUT=<<"string_ending_delimiter";
+
+ Configure Thunderbird 2.0 for IMAP
+ Thunderbird 2.0 mit IMAP konfigurieren
+ Configuration de Thunderbird 2.0 avec IMAP
+
+string_ending_delimiter
+
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/70EmailProviderEnd b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/70EmailProviderEnd
new file mode 100644
index 0000000..feb332a
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/70EmailProviderEnd
@@ -0,0 +1,2 @@
+
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/80Webmail b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/80Webmail
new file mode 100644
index 0000000..15bc6f8
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/80Webmail
@@ -0,0 +1,18 @@
+{
+#
+return " " if $horde{'status'} eq "disabled";
+
+$OUT=<<'string_ending_delimiter';
+
+
+
+ %EMAILLOCALPART%
+
+
+
+
+
+string_ending_delimiter
+}
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/90ClientConfigUpdate b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/90ClientConfigUpdate
new file mode 100644
index 0000000..8a46c6f
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/90ClientConfigUpdate
@@ -0,0 +1 @@
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/template-begin b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/template-begin
new file mode 100644
index 0000000..ceb1658
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/template-begin
@@ -0,0 +1,3 @@
+
+"; ?>
+
diff --git a/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/template-end b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/template-end
new file mode 100644
index 0000000..a1bb2c4
--- /dev/null
+++ b/root/etc/e-smith/templates/var/www/Autodiscover/Mozilla.php/template-end
@@ -0,0 +1 @@
+
diff --git a/root/home/e-smith/files/server-resources/regedit/Outlook2016.reg b/root/home/e-smith/files/server-resources/regedit/Outlook2016.reg
new file mode 100644
index 0000000..b978e35
--- /dev/null
+++ b/root/home/e-smith/files/server-resources/regedit/Outlook2016.reg
@@ -0,0 +1,4 @@
+Windows Registry Editor Version 5.00
+
+[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Office\16.0\Outlook\setup]
+"DisableOffice365SimplifiedAccountCreation"=dword:00000001
diff --git a/root/home/e-smith/files/server-resources/regedit/Outlook2019.reg b/root/home/e-smith/files/server-resources/regedit/Outlook2019.reg
new file mode 100644
index 0000000..d8d2451
--- /dev/null
+++ b/root/home/e-smith/files/server-resources/regedit/Outlook2019.reg
@@ -0,0 +1,4 @@
+Windows Registry Editor Version 5.00
+
+[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Office\19.0\Outlook\setup]
+"DisableOffice365SimplifiedAccountCreation"=dword:00000001
diff --git a/root/var/www/Autodiscover/.gitignore b/root/var/www/Autodiscover/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/smeserver-autodiscover.spec b/smeserver-autodiscover.spec
new file mode 100644
index 0000000..e4b363b
--- /dev/null
+++ b/smeserver-autodiscover.spec
@@ -0,0 +1,47 @@
+Name: smeserver-autodiscover
+Version: 1.0.0
+Release: 1%{?dist}
+Summary: Koozali SME Server autodiscovery
+License: GPL
+URL: https://wiki.koozali.org/Autodiscover
+Source: %{name}-%{version}.tar.xz
+BuildArch: noarch
+BuildRequires: e-smith-devtools
+
+%description
+Koozali SME Server autodiscovery
+configure your mail client with ease.
+
+
+%prep
+%setup
+
+%build
+perl createlinks
+
+
+%install
+rm -rf %{buildroot}
+(cd root ; find . -depth -print | cpio -dump %{buildroot})
+/sbin/e-smith/genfilelist %{buildroot} \
+ --dir '/var/www/Autodiscover/' 'attr(0750,root,www)' \
+ > %{name}-%{version}-%{release}-filelist
+
+
+
+%files -f %{name}-%{version}-%{release}-filelist
+%defattr(-,root,root)
+
+
+
+%changelog
+* Sat Sep 07 2024 cvs2git.sh aka Brian Read 1.0.0-1.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 Jul 13 2022 Jean-Philippe Pialasse 1.0.0-1.sme
+- initial release [SME: 10842]
+