diff --git a/mail/courier/Makefile b/mail/courier/Makefile
index 45e36b3a803e..261a340c8925 100644
--- a/mail/courier/Makefile
+++ b/mail/courier/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	courier
-PORTVERSION=	0.65.3
-PORTREVISION=	6
+PORTVERSION=	1.1.11
 CATEGORIES=	mail
 MASTER_SITES=	SF
 
@@ -11,17 +10,17 @@ WWW=		https://www.Courier-MTA.org/
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/COPYING.GPL
 
-BROKEN_FreeBSD_13=	ld: error: duplicate symbol: sqwebmail_content_charset
-BROKEN_FreeBSD_14=	ld: error: duplicate symbol: sqwebmail_content_charset
-
-BUILD_DEPENDS=	courierauthconfig:security/courier-authlib-base
+BUILD_DEPENDS=	courierauthconfig:security/courier-authlib-base \
+		wget:ftp/wget \
+		gpg:security/gnupg
+			
 LIB_DEPENDS=	libidn.so:dns/libidn \
 		libpcre.so:devel/pcre
 RUN_DEPENDS=	courierauthconfig:security/courier-authlib-base \
 		${LOCALBASE}/share/sysconftool/sysconftool:devel/sysconftool \
 		${LOCALBASE}/etc/mime.types:misc/mime-support \
 		p5-Net-CIDR>=0:net-mgmt/p5-Net-CIDR \
-		ca_root_nss>=3.*:security/ca_root_nss
+		ca_root_nss>=3.*:security/ca_root_nss 
 
 CONFLICTS=	courier-imap-2.* couriermlm-0.* \
 		exim-4.* maildrop-1.* \
@@ -90,7 +89,9 @@ CONFIGURE_ARGS=	--disable-root-check \
 		--with-transport='${WITH_TRANSPORT}' \
 		--with-default-maildrop=${MAILDROPDEFAULT} \
 		--with-paranoid-smtpext \
-		--enable-workarounds-for-imap-client-bugs
+		--enable-workarounds-for-imap-client-bugs \
+		--with-notice=unicode
+
 CPPFLAGS+=	-I${LOCALBASE}/include
 LIBS+=		-L${LOCALBASE}/lib
 
@@ -107,16 +108,13 @@ SUB_FILES+=	pkg-message crontab sharedindexupdate
 
 OPTIONS_DEFINE=	LDAP PROCMAIL SENDFAX UUCP IPV6 MAILDROPFLAGS DOCS
 OPTIONS_GROUP=	WEBMAIL
-#OPTIONS_GROUP=	SYSTEM WEBMAIL
-#OPTIONS_GROUP_SYSTEM=	RCCONF MAILCONF PERIODIC
-OPTIONS_GROUP_WEBMAIL=	GNUPG WEBMAILRSENT WEBMAILFLAGS WEBMAILXFACE
+OPTIONS_GROUP_WEBMAIL=	WEBMAILRSENT WEBMAILFLAGS WEBMAILXFACE
 OPTIONS_RADIO=	ALIASES SPELL
 OPTIONS_RADIO_ALIASES=	SYSTEMALIASES EMPTYALIASES
 OPTIONS_RADIO_SPELL=	ASPELL ISPELL
 OPTIONS_DEFAULT=WEBMAILRSENT SYSTEMALIASES
 
 LDAP_DESC=	LDAP-based mail aliasing support
-GNUPG_DESC=	GNU Privacy Guard support for WebMail
 ASPELL_DESC=	ASpell support for WebMail
 ISPELL_DESC=	ISpell support for WebMail
 PROCMAIL_DESC=	Procmail local delivery support
@@ -170,11 +168,6 @@ SUB_LIST+=	WITHEMPTYALIASES="@comment "
 .include "${.CURDIR}/../../security/courier-authlib/Makefile.dep"
 .endif
 
-.if ${PORT_OPTIONS:MGNUPG}
-BUILD_DEPENDS+=	gpg:security/gnupg
-RUN_DEPENDS+=	gpg:security/gnupg
-.endif
-
 .if ${PORT_OPTIONS:MASPELL}
 BUILD_DEPENDS+=	aspell:textproc/aspell
 RUN_DEPENDS+=	aspell:textproc/aspell
@@ -282,14 +275,14 @@ post-patch:
 	@${REINPLACE_CMD} -e 's|^PROG=\./|PROG=exec ./|g' \
 		${WRKSRC}/courier/module.*/courier.config
 	@${REINPLACE_CMD} -e 's|@mydatadir@|@sysconfdir@|g' \
-		${WRKSRC}/*/mk*cert.* \
-		${WRKSRC}/*/*/mk*cert.*
+		${WRKSRC}/libs/imap/mk*cert.* \
+		${WRKSRC}/libs/imap/mk*cert.*
 	@${REINPLACE_CMD} -e 's|^\(TLS_CERTFILE=\)@mydatadir@|\1@sysconfdir@|g' \
 		${WRKSRC}/*/*.dist.in \
 		${WRKSRC}/*/*/*.dist.in
 	@${REINPLACE_CMD} -e 's|^\(RANDFILE[[:space:]]*=[[:space:]]*\)@mydatadir@|\1@sysconfdir@|g' \
-		${WRKSRC}/*/*.cnf.openssl.in \
-		${WRKSRC}/*/*/*.cnf.openssl.in
+		${WRKSRC}/libs/imap/*.cnf.openssl.in \
+		${WRKSRC}/libs/imap/*.cnf.openssl.in
 	@${REINPLACE_CMD} -e 's|$$(INSTALL_DATA) \(.$$$$file.\)|${INSTALL_MAN} \1|' \
 		${WRKSRC}/Makefile.in \
 		${WRKSRC}/*/Makefile.in \
@@ -316,17 +309,17 @@ post-build:
 		     -e 's|^(session)\s+(required).*|$$1 \t$$2\tpam_permit.so|g;' \
 		${WRKSRC}/*/*.authpam* \
 		${WRKSRC}/*/*/*.authpam*
-	@${LN} -f ${WRKSRC}/gpglib/README.html		${WRKSRC}/gpglib/README.gpglib.html
-	@${LN} -f ${WRKSRC}/imap/BUGS			${WRKSRC}/imap/BUGS.imap
-	@${LN} -f ${WRKSRC}/imap/BUGS.html		${WRKSRC}/imap/BUGS.imap.html
-	@${LN} -f ${WRKSRC}/imap/README			${WRKSRC}/imap/README.imap
-	@${LN} -f ${WRKSRC}/imap/README.html		${WRKSRC}/imap/README.imap.html
-	@${LN} -f ${WRKSRC}/maildrop/README.html	${WRKSRC}/maildrop/README.maildrop.html
-	@${LN} -f ${WRKSRC}/pcp/README.html		${WRKSRC}/pcp/README.pcp.html
-	@${LN} -f ${WRKSRC}/webmail/BUGS		${WRKSRC}/webmail/BUGS.webmail
-	@${LN} -f ${WRKSRC}/webmail/BUGS.html		${WRKSRC}/webmail/BUGS.webmail.html
-	@${LN} -f ${WRKSRC}/webmail/SECURITY		${WRKSRC}/webmail/SECURITY.webmail
-	@${LN} -f ${WRKSRC}/webmail/SECURITY.html	${WRKSRC}/webmail/SECURITY.webmail.html
+	@${LN} -f ${WRKSRC}/libs/gpglib/README.html		${WRKSRC}/libs/gpglib/README.gpglib.html
+	@${LN} -f ${WRKSRC}/libs/imap/BUGS			${WRKSRC}/libs/imap/BUGS.imap
+	@${LN} -f ${WRKSRC}/libs/imap/BUGS.html		${WRKSRC}/libs/imap/BUGS.imap.html
+	@${LN} -f ${WRKSRC}/libs/imap/README.proxy			${WRKSRC}/libs/imap/README.imap.proxy
+	@${LN} -f ${WRKSRC}/libs/imap/README.proxy.html		${WRKSRC}/libs/imap/README.imap.proxy.html
+	@${LN} -f ${WRKSRC}/libs/maildrop/README.html	${WRKSRC}/libs/maildrop/README.maildrop.html
+	@${LN} -f ${WRKSRC}/libs/pcp/README.html		${WRKSRC}/libs/pcp/README.pcp.html
+	@${LN} -f ${WRKSRC}/libs/sqwebmail/BUGS		${WRKSRC}/libs/sqwebmail/BUGS.webmail
+	@${LN} -f ${WRKSRC}/libs/sqwebmail/BUGS.html		${WRKSRC}/libs/sqwebmail/BUGS.webmail.html
+	@${LN} -f ${WRKSRC}/libs/sqwebmail/SECURITY		${WRKSRC}/libs/sqwebmail/SECURITY.webmail
+	@${LN} -f ${WRKSRC}/libs/sqwebmail/SECURITY.html	${WRKSRC}/libs/sqwebmail/SECURITY.webmail.html
 
 post-install:
 	@${LN} -f ${STAGEDIR}${SYSCONFDIR}/maildrop ${STAGEDIR}${SYSCONFDIR}/maildropfilter
diff --git a/mail/courier/Makefile.doc b/mail/courier/Makefile.doc
index a0e0cfcc166e..d93cdb4798c9 100644
--- a/mail/courier/Makefile.doc
+++ b/mail/courier/Makefile.doc
@@ -8,24 +8,22 @@ DOCS=	AUTHORS \
 	NEWS \
 	README \
 	TODO \
-	imap/BUGS.imap \
-	imap/README.imap \
-	imap/README.proxy \
-	maildir/README.maildirquota.txt \
-	maildir/README.sharedfolders.txt \
-	tcpd/README.couriertls \
-	webmail/BUGS.webmail \
-	webmail/SECURITY.webmail
+	libs/imap/BUGS.imap \
+	libs/imap/README.imap.proxy \
+	libs/maildir/README.maildirquota.txt \
+	libs/maildir/README.sharedfolders.txt \
+	libs/tcpd/README.couriertls \
+	libs/sqwebmail/BUGS.webmail \
+	libs/sqwebmail/SECURITY.webmail
 
 HTMLDOCS=NEWS.html \
-	gpglib/README.gpglib.html \
-	imap/BUGS.imap.html \
-	imap/README.imap.html \
-	imap/README.proxy.html \
-	maildir/README.maildirfilter.html \
-	maildir/README.maildirquota.html \
-	maildir/README.sharedfolders.html \
-	maildrop/README.maildrop.html \
-	pcp/README.pcp.html \
-	webmail/BUGS.webmail.html \
-	webmail/SECURITY.webmail.html
+	libs/gpglib/README.gpglib.html \
+	libs/imap/BUGS.imap.html \
+	libs/imap/README.imap.proxy.html \
+	libs/maildir/README.maildirfilter.html \
+	libs/maildir/README.maildirquota.html \
+	libs/maildir/README.sharedfolders.html \
+	libs/maildrop/README.maildrop.html \
+	libs/pcp/README.pcp.html \
+	libs/sqwebmail/BUGS.webmail.html \
+	libs/sqwebmail/SECURITY.webmail.html
diff --git a/mail/courier/Makefile.own b/mail/courier/Makefile.own
index 3d1b346df0ba..9469928d30ea 100644
--- a/mail/courier/Makefile.own
+++ b/mail/courier/Makefile.own
@@ -38,10 +38,6 @@ OWNER0=	bin/courier-config \
 	etc/courier/pop3d.cnf \
 	etc/courier/pop3d.dist \
 	etc/courier/quotawarnmsg.example \
-	etc/courier/rfcerr2045.txt \
-	etc/courier/rfcerr2046.txt \
-	etc/courier/rfcerr2047.txt \
-	etc/courier/rfcerrheader.txt \
 	etc/courier/smtpaccess/default \
 	etc/courier/webmail.authpam \
 	etc/courier/webmlmrc.dist \
diff --git a/mail/courier/distinfo b/mail/courier/distinfo
index 0d76693c1c49..aa1c15fc847e 100644
--- a/mail/courier/distinfo
+++ b/mail/courier/distinfo
@@ -1,2 +1,3 @@
-SHA256 (courier-0.65.3.tar.bz2) = a743ba01137230165b00d726cf0faef3998d43edc0bfb00d8358eeefd96c7d60
-SIZE (courier-0.65.3.tar.bz2) = 7152828
+TIMESTAMP = 1669312609
+SHA256 (courier-1.1.11.tar.bz2) = 4fe3b73e7da159351ab973b52044996aa0006076f2effdcc4c004be087c5f777
+SIZE (courier-1.1.11.tar.bz2) = 7895772
diff --git a/mail/courier/files/patch-courier__cmlmfetch.C b/mail/courier/files/patch-courier__cmlmfetch.C
deleted file mode 100644
index 80a27c2f0156..000000000000
--- a/mail/courier/files/patch-courier__cmlmfetch.C
+++ /dev/null
@@ -1,11 +0,0 @@
---- courier/cmlmfetch.C.orig	2009-11-08 18:14:47 UTC
-+++ courier/cmlmfetch.C
-@@ -334,7 +334,7 @@ int doindex(const char *n)
- 			ack << std::setiosflags(std::ios::right)
- 			    << std::setw(10)
- 			    << msgs[i]
--			    << resetiosflags(std::ios::right) << " "
-+			    << std::resetiosflags(std::ios::right) << " "
- 			    << std::setw(0) << msginfo[i].msgsubj << std::endl;
- 			ack << std::setiosflags(std::ios::right)
- 			    << std::setw(10)
diff --git a/mail/courier/files/patch-courier__configure b/mail/courier/files/patch-courier__configure
deleted file mode 100644
index db86e5bf09ce..000000000000
--- a/mail/courier/files/patch-courier__configure
+++ /dev/null
@@ -1,63 +0,0 @@
---- courier/configure.orig	2009-09-05 13:59:59.000000000 +0200
-+++ courier/configure	2010-02-15 20:05:20.000000000 +0100
-@@ -819,6 +819,7 @@
- dirlist
- transport
- MODE
-+piddir
- COPYRIGHT
- testmode
- COURIERAUTHCONFIG
-@@ -954,6 +955,7 @@
- enable_libtool_lock
- with_softlinkdir
- with_testmode
-+with_piddir
- with_transport
- with_db
- with_courierlogger
-@@ -1629,6 +1631,7 @@
-   --with-softlinks=dir:link,dir:link...   specify soft links for
-                                           installation subdirectories.
-  -- This space intentionally left blank --
-+  --with-piddir         Directory where webmlm.pid is created
-   --with-transport='local esmtp ...'
-                           Specify list of modules to install
- 
-@@ -2553,7 +2556,7 @@
- fi
- 
- fi
--INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-+INSTALL_STRIP_PROGRAM="install  -s -o root -g wheel -m 555 -s"
- 
- { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
- $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
-@@ -15882,6 +15885,14 @@
- esac
- 
- 
-+# Check whether --with-piddir was given.
-+if test "${with_piddir+set}" = set; then
-+  withval=$with_piddir; piddir="$withval"
-+  else
-+    piddir=$localstatedir/run
-+fi
-+
-+
- version=`cat ../version`
- 
- COPYRIGHT="Courier $version Copyright 1999-2008 Double Precision, Inc."
-@@ -18397,9 +18408,9 @@
- 
- if test "$testmode" = "0"
- then
--	INSTALL_PROGRAM='${INSTALL} -m 700'
--	INSTALL_SCRIPT='${INSTALL} -m 700'
--	INSTALL_DATA='${INSTALL} -m 600'
-+	INSTALL_PROGRAM='${BSD_INSTALL_PROGRAM}'
-+	INSTALL_SCRIPT='${BSD_INSTALL_SCRIPT}'
-+	INSTALL_DATA='${BSD_INSTALL_DATA}'
- fi
- 
- ac_ext=cpp
diff --git a/mail/courier/files/patch-courier__doc__Makefile.in b/mail/courier/files/patch-courier__doc__Makefile.in
index 1d70f7f64cf6..f3ec63f34e0f 100644
--- a/mail/courier/files/patch-courier__doc__Makefile.in
+++ b/mail/courier/files/patch-courier__doc__Makefile.in
@@ -1,7 +1,7 @@
---- courier/doc/Makefile.in.orig	Sun Jul  3 00:15:30 2005
-+++ courier/doc/Makefile.in	Sun Jul  3 00:15:30 2005
-@@ -1136,18 +1136,18 @@
- 	$(MAKE) do-man-install
+--- courier/doc/Makefile.in.bak	2022-11-26 15:16:34.768401000 -0600
++++ courier/doc/Makefile.in	2022-11-26 15:19:33.753364000 -0600
+@@ -1415,16 +1415,16 @@
+ 	chmod 755 $(DESTDIR)$(htmldocdir)
  
  do-man-install:
 -	for f in $(mandir) $(man1dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chmod 755 $(DESTDIR)$$f ; done ; exit 0
@@ -10,23 +10,20 @@
  	for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chmod 644 $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
  	for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chmod 644 $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
  	for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chmod 644 $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(mandir) $(man1dir) $(man5dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chown bin $(DESTDIR)$$f && chgrp bin $(DESTDIR)$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man1) ; do test -f $(DESTDIR)$(man1dir)/$$f && chown bin $(DESTDIR)$(man1dir)/$$f && chgrp bin $(DESTDIR)$(man1dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chown bin $(DESTDIR)$(man5dir)/$$f && chgrp bin $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chown bin $(DESTDIR)$(man7dir)/$$f && chgrp bin $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chown bin $(DESTDIR)$(man8dir)/$$f && chgrp bin $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(mandir) $(man1dir) $(man5dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chown bin $(DESTDIR)$$f && chgrp bin $(DESTDIR)$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man1) ; do test -f $(DESTDIR)$(man1dir)/$$f && chown bin $(DESTDIR)$(man1dir)/$$f && chgrp bin $(DESTDIR)$(man1dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chown bin $(DESTDIR)$(man5dir)/$$f && chgrp bin $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chown bin $(DESTDIR)$(man7dir)/$$f && chgrp bin $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chown bin $(DESTDIR)$(man8dir)/$$f && chgrp bin $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
+-	test `id -u` = 0 || exit 0 ; for f in $(mandir) $(man1dir) $(man5dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chown bin $(DESTDIR)$$f && chgrp bin $(DESTDIR)$$f ; done ; exit 0
+-	test `id -u` = 0 || exit 0 ; for f in $(man1) ; do test -f $(DESTDIR)$(man1dir)/$$f && chown bin $(DESTDIR)$(man1dir)/$$f && chgrp bin $(DESTDIR)$(man1dir)/$$f ; done ; exit 0
+-	test `id -u` = 0 || exit 0 ; for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chown bin $(DESTDIR)$(man5dir)/$$f && chgrp bin $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
+-	test `id -u` = 0 || exit 0 ; for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chown bin $(DESTDIR)$(man7dir)/$$f && chgrp bin $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
+-	test `id -u` = 0 || exit 0 ; for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chown bin $(DESTDIR)$(man8dir)/$$f && chgrp bin $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
++#	test `id -u` = 0 || exit 0 ; for f in $(mandir) $(man1dir) $(man5dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chown bin $(DESTDIR)$$f && chgrp bin $(DESTDIR)$$f ; done ; exit 0
++#	test `id -u` = 0 || exit 0 ; for f in $(man1) ; do test -f $(DESTDIR)$(man1dir)/$$f && chown bin $(DESTDIR)$(man1dir)/$$f && chgrp bin $(DESTDIR)$(man1dir)/$$f ; done ; exit 0
++#	test `id -u` = 0 || exit 0 ; for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chown bin $(DESTDIR)$(man5dir)/$$f && chgrp bin $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
++#	test `id -u` = 0 || exit 0 ; for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chown bin $(DESTDIR)$(man7dir)/$$f && chgrp bin $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
++#	test `id -u` = 0 || exit 0 ; for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chown bin $(DESTDIR)$(man8dir)/$$f && chgrp bin $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
  	for f in $(htmldoc_DATA) ; do chmod 444 $(DESTDIR)$(htmldocdir)/$$f ; done
--	test -w /etc || exit 0; for f in $(htmldoc_DATA) ; do chown bin $(DESTDIR)$(htmldocdir)/$$f ; chgrp bin $(DESTDIR)$(htmldocdir)/$$f ; done
-+#	test -w /etc || exit 0; for f in $(htmldoc_DATA) ; do chown bin $(DESTDIR)$(htmldocdir)/$$f ; chgrp bin $(DESTDIR)$(htmldocdir)/$$f ; done
+ 	test `id -u` = 0 || exit 0; for f in $(htmldoc_DATA) ; do chown bin $(DESTDIR)$(htmldocdir)/$$f ; chgrp bin $(DESTDIR)$(htmldocdir)/$$f ; done
  
- status.html: config.status
- 
-@@ -1160,24 +1160,24 @@
+@@ -1439,23 +1439,23 @@
  	@SUBDIRS="$(SUBDIRS)" ; for f in $$SUBDIRS ; do ( cd $$f && $(MAKE) $(AM_MAKEFLAGS) install-perms ) ; cat /dev/null >>$$f/permissions.dat ; cat $$f/permissions.dat >>permissions.dat ; done
  
  install-perms-local:
@@ -36,36 +33,29 @@
 -	@echo $(man7dir) 755 bin bin >>permissions.dat
 -	@echo $(man8dir) 755 bin bin >>permissions.dat
 -	@for f in $(man1) ; do	\
--	echo $(man1dir)/$$f 644 bin bin man >>permissions.dat ; done
--	@for f in $(man5) ; do	\
--	echo $(man5dir)/$$f 644 bin bin man >>permissions.dat ; done
--	@for f in $(man7) ; do	\
--	echo $(man7dir)/$$f 644 bin bin man >>permissions.dat ; done
--	@for f in $(man8) ; do	\
--	echo $(man8dir)/$$f 644 bin bin man >>permissions.dat ; done
--	@for f in $(man_LINKS) ; do	\
--	echo $$f 644 bin bin man >>permissions.dat ; done
--	@echo $(htmldocdir) 755 bin bin >>permissions.dat
--	@for f in $(htmldoc_DATA) ; do \
--	echo $(htmldocdir)/$$f 444 bin bin doc >>permissions.dat ; done
 +#	@echo @mandir@ 755 bin bin >>permissions.dat
 +#	@echo $(man1dir) 755 bin bin >>permissions.dat
 +#	@echo $(man5dir) 755 bin bin >>permissions.dat
 +#	@echo $(man7dir) 755 bin bin >>permissions.dat
 +#	@echo $(man8dir) 755 bin bin >>permissions.dat
 +#	@for f in $(man1) ; do	\
-+#	echo $(man1dir)/$$f 644 bin bin man >>permissions.dat ; done
+ 	echo $(man1dir)/$$f 644 bin bin man >>permissions.dat ; done
+-	@for f in $(man5) ; do	\
 +#	@for f in $(man5) ; do	\
-+#	echo $(man5dir)/$$f 644 bin bin man >>permissions.dat ; done
+ 	echo $(man5dir)/$$f 644 bin bin man >>permissions.dat ; done
+-	@for f in $(man7) ; do	\
 +#	@for f in $(man7) ; do	\
-+#	echo $(man7dir)/$$f 644 bin bin man >>permissions.dat ; done
+ 	echo $(man7dir)/$$f 644 bin bin man >>permissions.dat ; done
+-	@for f in $(man8) ; do	\
 +#	@for f in $(man8) ; do	\
-+#	echo $(man8dir)/$$f 644 bin bin man >>permissions.dat ; done
+ 	echo $(man8dir)/$$f 644 bin bin man >>permissions.dat ; done
+-	@for f in $(man_LINKS) ; do	\
 +#	@for f in $(man_LINKS) ; do	\
-+#	echo $$f 644 bin bin man >>permissions.dat ; done
+ 	echo $$f 644 bin bin man >>permissions.dat ; done
+-	@echo $(htmldocdir) 755 bin bin >>permissions.dat
+-	@for f in $(htmldoc_DATA) ; do \
 +#	@echo $(htmldocdir) 755 bin bin >>permissions.dat
 +#	@for f in $(htmldoc_DATA) ; do \
-+#	echo $(htmldocdir)/$$f 444 bin bin doc >>permissions.dat ; done
+ 	echo $(htmldocdir)/$$f 444 bin bin doc >>permissions.dat ; done
  
  htmldoc: $(htmldocfiles)
- 	echo '/icon\.gif/a'"\\" >htmldoc.sed
diff --git a/mail/courier/files/patch-courier__libs__Makefile.in b/mail/courier/files/patch-courier__libs__Makefile.in
new file mode 100644
index 000000000000..e1e48c56da67
--- /dev/null
+++ b/mail/courier/files/patch-courier__libs__Makefile.in
@@ -0,0 +1,13 @@
+--- courier/libs/Makefile.in.bak	2022-11-26 18:33:41.000709000 -0600
++++ courier/libs/Makefile.in	2022-11-26 18:34:33.033673000 -0600
+@@ -1213,8 +1213,8 @@
+ .PRECIOUS: Makefile
+ 
+ 
+-courier_version.h: ../../version
+-	echo '#define COURIER_VERSION "'`cat ../../version`'"' >courier_version.h
++courier_version.h: ../../version.txt
++	echo '#define COURIER_VERSION "'`cat ../../version.txt`'"' >courier_version.h
+ 
+ #
+ # lcrwstatic.h is dynamically built to link with initialization functions
diff --git a/mail/courier/files/patch-courier__module.esmtp__mkesmtpdcert.in b/mail/courier/files/patch-courier__module.esmtp__mkesmtpdcert.in
index aa6d563837a5..2bde11ac35f8 100644
--- a/mail/courier/files/patch-courier__module.esmtp__mkesmtpdcert.in
+++ b/mail/courier/files/patch-courier__module.esmtp__mkesmtpdcert.in
@@ -1,6 +1,6 @@
 --- courier/module.esmtp/mkesmtpdcert.in.orig	2010-02-15 21:37:57.000000000 +0100
 +++ courier/module.esmtp/mkesmtpdcert.in	2010-02-15 21:37:16.000000000 +0100
-@@ -36,7 +36,7 @@
+@@ -41,1 +41,1 @@
  then
  	cp /dev/null @mydatadir@/esmtpd.pem
  	chmod 600 @mydatadir@/esmtpd.pem
diff --git a/mail/courier/files/patch-courier__perms.sh.in b/mail/courier/files/patch-courier__perms.sh.in
index fe80b2bf349b..be4447340089 100644
--- a/mail/courier/files/patch-courier__perms.sh.in
+++ b/mail/courier/files/patch-courier__perms.sh.in
@@ -1,24 +1,28 @@
---- courier/perms.sh.in.orig	2007-07-01 11:36:31.000000000 -0400
-+++ courier/perms.sh.in	2007-07-01 11:36:31.000000000 -0400
-@@ -11,9 +11,6 @@
+--- courier/perms.sh.in.bak	2022-11-26 15:33:06.239715000 -0600
++++ courier/perms.sh.in	2022-11-26 15:43:06.562335000 -0600
+@@ -10,9 +10,9 @@
  datarootdir="@datarootdir@"
  
  PERMS="
 -.			755
 -
 -@localstatedir@		755	x	bin	bin
++#.			755
++#
++#@localstatedir@		755	x	bin	bin
  @localstatedir@/tmp	770
  @localstatedir@/msgs	750
  @localstatedir@/msgq	750
-@@ -47,7 +44,6 @@
- @sysconfdir@/rfcerr2046.txt	444	config
- @sysconfdir@/rfcerr2047.txt	444	config
+@@ -44,7 +44,7 @@
+ @sysconfdir@/webmlmrc.dist	644	config
+ @sysconfdir@/quotawarnmsg.example	444
  
 -@libexecdir@		755	x	bin	bin
++#@libexecdir@		755	x	bin	bin
  @libexecdir@/courier	755	x	bin	bin
  @libexecdir@/courier/modules	755	x	bin	bin
  @libexecdir@/courier/submitmkdir	4550
-@@ -61,14 +57,13 @@
+@@ -58,14 +58,14 @@
  @libexecdir@/courier/makedatprog	555
  @libexecdir@/courier/imaplogin		555	x	bin	bin
  @libexecdir@/courier/pcpd		555	x	bin	bin
@@ -27,44 +31,36 @@
  @libexecdir@/courier/webmail/webmail	555	x	root	bin
  @libexecdir@/courier/webmail/webmlm	555	x	root	bin
  @libexecdir@/courier/sqwebmaild		555
--@libexecdir@/courier/sqwebpasswd	2755
--@libexecdir@/courier/webmail/webadmin	4555	x	root	bin
-+@libexecdir@/courier/sqwebpasswd	2555
-+@libexecdir@/courier/webmail/webadmin	4511	x	root	bin
+ @libexecdir@/courier/sqwebpasswd	2555
+-@libexecdir@/courier/webmail/webadmin	511	x	root	root
++@libexecdir@/courier/webmail/webadmin	4511	x	root	root
  
 -@sbindir@			755	x	bin	bin
++#@sbindir@			755	x	bin	bin
  @sbindir@/courier		555
  @sbindir@/showconfig		555
  @sbindir@/showmodules		550
-@@ -82,7 +77,6 @@
+@@ -79,7 +79,7 @@
  @datadir@/imapd			555	x	bin	bin
  @datadir@/imapd-ssl		555	x	bin	bin
  
 -@bindir@			755	x	bin	bin
++#@bindir@			755	x	bin	bin
  @bindir@/cancelmsg		6555
  @bindir@/courier-config		555
  @bindir@/mailq			2555
-@@ -111,10 +105,10 @@
- @sbindir@/makealiases		550
- @datadir@/makehosteddomains	555
+@@ -110,10 +110,10 @@
  @sbindir@/makehosteddomains	555
--@datadir@/pop3d			755
--@sbindir@/pop3d			755
--@datadir@/pop3d-ssl		755
--@sbindir@/pop3d-ssl		755
-+@datadir@/pop3d			555
-+@sbindir@/pop3d			555
-+@datadir@/pop3d-ssl		555
-+@sbindir@/pop3d-ssl		555
+ @datadir@/makeimapaccess	555
+ @sbindir@/makeimapaccess	555
+-@datadir@/pop3d			555
+-@sbindir@/pop3d			555
+-@datadir@/pop3d-ssl		555
+-@sbindir@/pop3d-ssl		555
++#@datadir@/pop3d			555
++#@sbindir@/pop3d			555
++#@datadir@/pop3d-ssl		555
++#@sbindir@/pop3d-ssl		555
  @sbindir@/webgpg		555
  
  @datadir@			755	x	bin	bin
-@@ -226,7 +220,7 @@
- if test "@HAVE_LDAP@" != 0
- then
- 	echo @sysconfdir@/ldapaliasrc.dist 640 @mailuser@ @mailgroup@ config
--	echo @sbindir@/courierldapaliasd 700 @mailuser@ @mailgroup@
-+	echo @sbindir@/courierldapaliasd 500 @mailuser@ @mailgroup@
- fi
- 
- echo @datadir@/sqwebmail/images 755 @mailuser@ @mailgroup@
diff --git a/mail/courier/files/patch-courier__submit2.C b/mail/courier/files/patch-courier__submit2.C
deleted file mode 100644
index a85379056c20..000000000000
--- a/mail/courier/files/patch-courier__submit2.C
+++ /dev/null
@@ -1,11 +0,0 @@
---- courier/submit2.C.orig	2008-01-29 13:06:47.000000000 +0100
-+++ courier/submit2.C	2009-10-03 22:34:47.000000000 +0200
-@@ -860,7 +860,7 @@
- 	if (sizelimit && bytecount > sizelimit)
- 	{
- 		std::cout << "523 Message length (" <<
--			sizelimit << " bytes) exceeds administrative limit."
-+			bytecount << " bytes) exceeds administrative limit(" << sizelimit << ")."
- 			<< std::endl << std::flush;
- 		return (1);
- 	}
diff --git a/mail/courier/files/patch-courier__webmlmd.H b/mail/courier/files/patch-courier__webmlmd.H
deleted file mode 100644
index 0af669fecaf4..000000000000
--- a/mail/courier/files/patch-courier__webmlmd.H
+++ /dev/null
@@ -1,11 +0,0 @@
---- courier/webmlmd.H.orig	2007-12-17 12:09:18 UTC
-+++ courier/webmlmd.H
-@@ -49,7 +49,7 @@ namespace webmlmd {
- 		T t;
- 
- 		t.reserve(s.size() * 6 / 5);
--		class T::iterator b=s.begin(), e=s.end(), p=b;
-+		typename T::iterator b=s.begin(), e=s.end(), p=b;
- 
- 		while (b != e)
- 		{
diff --git a/mail/courier/files/patch-courier__webmlmd.rc.in b/mail/courier/files/patch-courier__webmlmd.rc.in
index e947e3631820..37c06e0198e4 100644
--- a/mail/courier/files/patch-courier__webmlmd.rc.in
+++ b/mail/courier/files/patch-courier__webmlmd.rc.in
@@ -1,5 +1,5 @@
---- courier/webmlmd.rc.in.orig	2007-03-05 05:43:24.000000000 +0100
-+++ courier/webmlmd.rc.in	2009-10-03 22:18:39.000000000 +0200
+--- courier/webmlmd.rc.in.bak	2022-11-26 15:59:10.584419000 -0600
++++ courier/webmlmd.rc.in	2022-11-26 16:01:03.914500000 -0600
 @@ -1,48 +1,48 @@
  #! @SHELL@
  
@@ -56,6 +56,6 @@
  
 -	@SETENV@ -i @SHELL@ -c "set -a; . $3; $prog check || exit 1; \
 +	@SETENV@ -i @SHELL@ -c "set -a; . $2; $prog check || exit 1; \
+ 		@MKDIR_P@ `dirname $PIDFILE` ; \
  		@courierlogger@ -pid="'"${PIDFILE}"'" $LOGGEROPTS -restart $prog"
  	exit $?
- 	;;
diff --git a/mail/courier/files/patch-courier__webmlmrc.dist.in b/mail/courier/files/patch-courier__webmlmrc.dist.in
index d347eca8c071..080e546402c6 100644
--- a/mail/courier/files/patch-courier__webmlmrc.dist.in
+++ b/mail/courier/files/patch-courier__webmlmrc.dist.in
@@ -1,5 +1,5 @@
---- courier/webmlmrc.dist.in.orig	Sun Apr  8 21:03:03 2007
-+++ courier/webmlmrc.dist.in	Sun Jun 10 11:54:35 2007
+--- courier/webmlmrc.dist.in.bak	2022-11-26 15:53:49.825433000 -0600
++++ courier/webmlmrc.dist.in	2022-11-26 15:54:52.884349000 -0600
 @@ -19,7 +19,7 @@
  #
  # The PID file.  Don't change unless you know what you're doing.
diff --git a/mail/courier/files/patch-imap__mkimapdcert.in b/mail/courier/files/patch-imap__mkimapdcert.in
deleted file mode 100644
index e44fb39c2d5b..000000000000
--- a/mail/courier/files/patch-imap__mkimapdcert.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- imap/mkimapdcert.in.orig	2010-02-15 21:42:15.000000000 +0100
-+++ imap/mkimapdcert.in	2010-02-15 21:36:46.000000000 +0100
-@@ -40,7 +40,7 @@
- then
- 	cp /dev/null @certsdir@/imapd.pem
- 	chmod 600 @certsdir@/imapd.pem
--	chown @mailuser@ @certsdir@/imapd.pem
-+	/usr/sbin/chown @mailuser@ @certsdir@/imapd.pem
- 
- 	dd if=@RANDOMV@ of=@certsdir@/imapd.rand count=1 2>/dev/null
- 	@OPENSSL@ req -new -x509 -days 365 -nodes \
diff --git a/mail/courier/files/patch-imap__mkpop3dcert.in b/mail/courier/files/patch-imap__mkpop3dcert.in
deleted file mode 100644
index 3bc4e84df091..000000000000
--- a/mail/courier/files/patch-imap__mkpop3dcert.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- imap/mkpop3dcert.in.orig	2010-02-15 21:45:23.000000000 +0100
-+++ imap/mkpop3dcert.in	2010-02-15 21:37:01.000000000 +0100
-@@ -40,7 +40,7 @@
- then
- 	cp /dev/null @certsdir@/pop3d.pem
- 	chmod 600 @certsdir@/pop3d.pem
--	chown @mailuser@ @certsdir@/pop3d.pem
-+	/usr/sbin/chown @mailuser@ @certsdir@/pop3d.pem
- 
- 	dd if=@RANDOMV@ of=@certsdir@/pop3d.rand count=1 2>/dev/null
- 	@OPENSSL@ req -new -x509 -days 365 -nodes \
diff --git a/mail/courier/files/patch-liblock__locktest.c b/mail/courier/files/patch-liblock__locktest.c
deleted file mode 100644
index 9f701700d7f2..000000000000
--- a/mail/courier/files/patch-liblock__locktest.c
+++ /dev/null
@@ -1,81 +0,0 @@
---- liblock/locktest.c.orig	Mon Dec  6 08:18:55 1999
-+++ liblock/locktest.c	Mon Dec  6 08:18:55 1999
-@@ -5,6 +5,7 @@
- 
- /* $Id */
- 
-+#include	<paths.h>
- #include	"liblock.h"
- #if	USE_FCNTL
- #include	"lockfcntl.c"
-@@ -20,11 +21,23 @@
- 
- int main()
- {
-+#define FILENAME	"courier-authlib.locktest.XXXXX"
- int	fd[2];
- pid_t	p;
- int	s;
- int	f;
- 
-+	char *name;
-+	const char *tmpdir;
-+	if ((tmpdir = (char *)getenv("TMPDIR")) == NULL)
-+		tmpdir = _PATH_TMP;
-+	(void)asprintf(&name, "%s%s%s", tmpdir,
-+		(tmpdir[strlen(tmpdir) - 1] == '/') ? "" : "/", FILENAME);
-+	if (name == NULL) {
-+		perror("get filename");
-+		exit(1);
-+	}
-+
- 	signal(SIGCHLD, SIG_DFL);
- 	if (pipe(fd))
- 	{
-@@ -32,6 +45,12 @@
- 		return (1);
- 	}
- 
-+	if ((f=mkstemp(name)) < 0)
-+	{
-+		perror("open");
-+		exit(1);
-+	}
-+
- 	if ((p=fork()) == (pid_t)-1)
- 	{
- 		perror("fork");
-@@ -46,7 +65,7 @@
- 		read(fd[0], &c, 1);
- 		close(fd[0]);
- 
--		if ((f=open("conftest.lock", O_RDWR|O_CREAT, 0644)) < 0)
-+		if ((f=open(name, O_RDWR)) < 0)
- 		{
- 			perror("open");
- 			exit(1);
-@@ -56,22 +75,18 @@
- 		if (ll_lockfd(f, ll_writelock, 0, 0))
- 		{
- 			close(f);
-+			unlink(name);
- 			exit(0);
- 		}
- 		close(f);
- 		exit(1);
- 	}
--	
--	if ((f=open("conftest.lock", O_RDWR|O_CREAT, 0644)) < 0)
--	{
--		perror("open");
--		exit(1);
--	}
- 
- 	if (ll_lockfd(f, ll_writelock, 0, 0))
- 	{
- 		perror("lock");
- 		close(f);
-+		unlink(name);
- 		exit(1);
- 	}
- 	close(fd[1]);
diff --git a/mail/courier/files/patch-tcpd__libcouriertls.c b/mail/courier/files/patch-tcpd__libcouriertls.c
deleted file mode 100644
index 993d5cf2aded..000000000000
--- a/mail/courier/files/patch-tcpd__libcouriertls.c
+++ /dev/null
@@ -1,18 +0,0 @@
---- tcpd/libcouriertls.c.orig	2009-11-21 21:07:32.000000000 +0100
-+++ tcpd/libcouriertls.c	2015-03-07 22:46:47.521076321 +0100
-@@ -551,9 +551,13 @@
- 	if (!protocol || !*protocol)
- 		protocol="SSL23";
- 
--	ctx=SSL_CTX_new(protocol && strcmp(protocol, "SSL2") == 0
--							? SSLv2_method():
-+	ctx=SSL_CTX_new(
-+#ifndef OPENSSL_NO_SSL2
-+		protocol && strcmp(protocol, "SSL2") == 0 ? SSLv2_method():
-+#endif
-+#ifndef OPENSSL_NO_SSL3
- 		protocol && strcmp(protocol, "SSL3") == 0 ? SSLv3_method():
-+#endif
- 		protocol && strcmp(protocol, "SSL23") == 0 ? SSLv23_method():
- 		TLSv1_method());
- 
