--- /dev/null
+diff --git a/THANKS b/THANKS\r
+index 9613133d..1d4dfd0d 100644\r
+--- a/THANKS\r
++++ b/THANKS\r
+@@ -43,6 +43,7 @@ Erich Eckner erich dot eckner at gmx dot de\r
+ Paul Eggert eggert at cs dot ucla dot edu\r
+ Justin Ellingwood JustinEllingwood at gmail dot com\r
+ Robert Elz kre at munnari dot OZ dot AU\r
++Brian Evans grknight at gentoo dot org\r
+ Rich Felker dalias at libc dot org\r
+ Dr. Werner Fink werner at suse dot de\r
+ Felix Fontein felix at fontein dot de\r
+diff --git a/mx-test.sh b/mx-test.sh\r
+index 4a60a1b0..201b00e7 100755\r
+--- a/mx-test.sh\r
++++ b/mx-test.sh\r
+@@ -5442,12 +5442,17 @@ t_mta_aliases() {\r
+ ## xxx The following are actually *expandaddr* tests!!\r
+ \r
+ # May not send plain names over SMTP!\r
+- echo | ${MAILX} ${ARGS} -Smta=smtp://laber.backe \\r
+- -Smta-aliases=./.tali \\r
+- -b a3 -c a2 a1 > ./.tall 2>&1\r
+- check_exn0 3\r
+- check 4 - "${MBOX}" '1172368381 238'\r
+- if have_feat uistrings; then\r
++ mtaali=\r
++ if have_feat smtp; then\r
++ echo | ${MAILX} ${ARGS} \\r
++ -Smta=smtp://laber.backe -Ssmtp-auth=none \\r
++ -Smta-aliases=./.tali \\r
++ -b a3 -c a2 a1 > ./.tall 2>&1\r
++ check_exn0 3\r
++ check 4 - "${MBOX}" '1172368381 238'\r
++ mtaali=1\r
++ fi\r
++ if [ -n "${mtaali}" ] && have_feat uistrings; then\r
+ check 5 - .tall '771616226 179'\r
+ else\r
+ t_echoskip '5:[test unsupported]'\r
+diff --git a/src/mx/cmd-resend.c b/src/mx/cmd-resend.c\r
+index 488c9b78..31f20609 100644\r
+--- a/src/mx/cmd-resend.c\r
++++ b/src/mx/cmd-resend.c\r
+@@ -723,7 +723,11 @@ jleave:\r
+ \r
+ static int\r
+ a_crese_resend1(void *vp, boole add_resent){\r
+- struct mx_url url;\r
++#ifdef mx_HAVE_NET\r
++ struct mx_url url, *urlp = &url;\r
++#else\r
++ struct mx_url *urlp = NIL;\r
++#endif\r
+ struct header head;\r
+ struct mx_name *myto, *myrawto;\r
+ boole mta_isexe;\r
+@@ -747,7 +751,7 @@ jedar:\r
+ goto jleave;\r
+ }\r
+ \r
+- if(!(mta_isexe = mx_sendout_mta_url(&url)))\r
++ if(!(mta_isexe = mx_sendout_mta_url(urlp)))\r
+ goto jleave;\r
+ mta_isexe = (mta_isexe != TRU1);\r
+ \r
+@@ -794,7 +798,7 @@ jedar:\r
+ head.h_mailx_orig_cc = lextract(hfield1("cc", mp), GCC | gf);\r
+ head.h_mailx_orig_bcc = lextract(hfield1("bcc", mp), GBCC | gf);\r
+ \r
+- if(n_resend_msg(mp, (mta_isexe ? NIL : &url), &head, add_resent\r
++ if(n_resend_msg(mp, (mta_isexe ? NIL : urlp), &head, add_resent\r
+ ) != OKAY){\r
+ /* n_autorec_relax_gut(); XXX but is handled automatically? */\r
+ goto jleave;\r
+diff --git a/src/mx/sendout.c b/src/mx/sendout.c\r
+index 2b0e8bf0..c4f373c1 100644\r
+--- a/src/mx/sendout.c\r
++++ b/src/mx/sendout.c\r
+@@ -2060,9 +2060,13 @@ FL enum okay\r
+ n_mail1(enum n_mailsend_flags msf, struct header *hp, struct message *quote,\r
+ char const *quotefile)\r
+ {\r
+- struct n_sigman sm;\r
++#ifdef mx_HAVE_NET\r
+ struct mx_cred_ctx cc;\r
+- struct mx_url url;\r
++ struct mx_url url, *urlp = &url;\r
++#else\r
++ struct mx_url *urlp = NIL;\r
++#endif\r
++ struct n_sigman sm;\r
+ struct sendbundle sb;\r
+ struct mx_name *to;\r
+ boole dosign, mta_isexe;\r
+@@ -2121,7 +2125,7 @@ n_mail1(enum n_mailsend_flags msf, struct header *hp, struct message *quote,\r
+ #ifndef mx_HAVE_SMIME\r
+ if (dosign) {\r
+ n_err(_("No S/MIME support compiled in\n"));\r
+- goto jleave;\r
++ goto jfail_dead;\r
+ }\r
+ #endif\r
+ \r
+@@ -2139,8 +2143,8 @@ n_mail1(enum n_mailsend_flags msf, struct header *hp, struct message *quote,\r
+ * TODO header fields ONCE, call that ONCE after user editing etc. has\r
+ * TODO completed (one edit cycle) */\r
+ \r
+- if(!(mta_isexe = mx_sendout_mta_url(&url)))\r
+- goto jleave;\r
++ if(!(mta_isexe = mx_sendout_mta_url(urlp)))\r
++ goto jfail_dead;\r
+ mta_isexe = (mta_isexe != TRU1);\r
+ \r
+ /* Take the user names from the combined to and cc lists and do all the\r
+@@ -2174,8 +2178,10 @@ n_mail1(enum n_mailsend_flags msf, struct header *hp, struct message *quote,\r
+ sb.sb_hp = hp;\r
+ sb.sb_to = to;\r
+ sb.sb_input = mtf;\r
+- sb.sb_urlp = mta_isexe ? NIL : &url;\r
++ sb.sb_urlp = mta_isexe ? NIL : urlp;\r
++#ifdef mx_HAVE_NET\r
+ sb.sb_credp = &cc;\r
++#endif\r
+ \r
+ if((dosign || count_nonlocal(to) > 0) &&\r
+ !_sendbundle_setup_creds(&sb, (dosign > 0))){\r
+@@ -2728,8 +2734,10 @@ FL enum okay\r
+ n_resend_msg(struct message *mp, struct mx_url *urlp, struct header *hp,\r
+ boole add_resent)\r
+ {\r
+- struct n_sigman sm;\r
++#ifdef mx_HAVE_NET\r
+ struct mx_cred_ctx cc;\r
++#endif\r
++ struct n_sigman sm;\r
+ struct sendbundle sb;\r
+ FILE * volatile ibuf, *nfo, * volatile nfi;\r
+ struct mx_fs_tmp_ctx *fstcp;\r
+@@ -2794,7 +2802,9 @@ n_resend_msg(struct message *mp, struct mx_url *urlp, struct header *hp,\r
+ sb.sb_to = to;\r
+ sb.sb_input = nfi;\r
+ sb.sb_urlp = urlp;\r
++#ifdef mx_HAVE_NET\r
+ sb.sb_credp = &cc;\r
++#endif\r
+ \r
+ if(!_sendout_error &&\r
+ count_nonlocal(to) > 0 && !_sendbundle_setup_creds(&sb, FAL0)){\r
+diff --git a/src/mx/url.c b/src/mx/url.c\r
+index 574e7c56..4bd55fb5 100644\r
+--- a/src/mx/url.c\r
++++ b/src/mx/url.c\r
+@@ -321,29 +321,33 @@ mx_url_parse(struct mx_url *urlp, enum cproto cproto, char const *data){\r
+ \r
+ rv = FAL0;\r
+ \r
++#ifdef mx_HAVE_TLS\r
++# define a_OUCH 0\r
++#else\r
++# define a_OUCH 1\r
++#endif\r
++\r
+ /* Network protocol */\r
+ #define a_PROTOX(X,Y,Z) \\r
+ urlp->url_portno = Y;\\r
+ su_mem_copy(urlp->url_proto, X "://\0", sizeof(X "://\0"));\\r
+ urlp->url_proto[sizeof(X) -1] = '\0';\\r
+ urlp->url_proto_len = sizeof(X) -1;\\r
+- do{ Z; }while(0)\r
++ if(a_OUCH){ Z; }\r
+ #define a_PRIVPROTOX(X,Y,Z) \\r
+ do{ a_PROTOX(X, Y, Z); }while(0)\r
+-#define a__IF(X,Y,Z) \\r
++\r
++#define a__IF(T,X,Y,Z) \\r
+ if(!su_cs_cmp_case_n(data, X "://", sizeof(X "://") -1)){\\r
++ if(a_OUCH && T)\\r
++ goto jeproto;\\r
+ a_PROTOX(X, Y, Z);\\r
+ data += sizeof(X "://") -1;\\r
+ goto juser;\\r
+ }\r
+-#define a_IF(X,Y) a__IF(X, Y, (void)0)\r
+-#ifdef mx_HAVE_TLS\r
+-# define a_IFS(X,Y) a__IF(X, Y, urlp->url_flags |= mx_URL_TLS_REQUIRED)\r
+-# define a_IFs(X,Y) a__IF(X, Y, urlp->url_flags |= mx_URL_TLS_OPTIONAL)\r
+-#else\r
+-# define a_IFS(X,Y) goto jeproto;\r
+-# define a_IFs(X,Y) a_IF(X, Y)\r
+-#endif\r
++#define a_IF(X,Y) a__IF(0, X, Y, (void)0)\r
++#define a_IFS(X,Y) a__IF(1, X, Y, urlp->url_flags |= mx_URL_TLS_REQUIRED)\r
++#define a_IFs(X,Y) a__IF(0, X, Y, urlp->url_flags |= mx_URL_TLS_OPTIONAL)\r
+ \r
+ switch(cproto){\r
+ case CPROTO_CERTINFO:\r
+@@ -413,6 +417,7 @@ mx_url_parse(struct mx_url *urlp, enum cproto cproto, char const *data){\r
+ #endif\r
+ }\r
+ \r
++#undef a_OUCH\r
+ #undef a_PRIVPROTOX\r
+ #undef a_PROTOX\r
+ #undef a__IF\r
--- /dev/null
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+HOMEPAGE="https://www.sdaoden.eu/code.html"
+DESCRIPTION="Enhanced mailx-compatible mail client based on Hierloom mailx (nail)"
+LICENSE="BSD BSD-4 ISC RSA"
+
+SRC_URI="https://ftp.sdaoden.eu/${P}.tar.xz"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="idn kerberos libressl net ssl"
+
+RDEPEND="
+ sys-libs/ncurses:0=
+ virtual/libiconv
+ idn? ( net-dns/libidn2 )
+ net? (
+ ssl? (
+ !libressl? ( dev-libs/openssl:0 )
+ libressl? ( dev-libs/libressl )
+ )
+ kerberos? ( virtual/krb5 )
+ )
+ !mail-client/mailx
+ !net-mail/mailutils
+ !mail-client/nail
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/awk"
+
+PATCHES=( "${FILESDIR}/s-nail-14.9.15-havenet.patch" )
+
+src_configure() {
+ local confopts=(
+ CC=$(tc-getCC)
+ EXTRA_CFLAGS=-std=c99
+ strip=/bin/true
+ OPT_AUTOCC=no
+ VAL_PREFIX="${EPREFIX}"/usr
+ VAL_SYSCONFDIR="${EPREFIX}"/etc
+ VAL_MTA="${EPREFIX}/usr/sbin/sendmail"
+ VAL_MAIL='/var/spool/mail'
+ VAL_PAGER=less
+ $(usex idn VAL_IDNA=idn2 OPT_IDNA=no)
+ VERBOSE=1
+ )
+
+ if use net; then
+ confopts+=( OPT_TLS=$(usex ssl require no)
+ OPT_GSSAPI=$(usex kerberos require no)
+ )
+ else
+ confopts+=( OPT_NET=no )
+ fi
+
+ tc-is-cross-compiler && confopts+=( OPT_CROSS_BUILD=yes )
+
+ emake "${confopts[@]}" config
+}
+
+src_compile() {
+ emake build
+}
+
+src_install () {
+ # Use /usr/sbin/sendmail by default and provide an example
+ cat <<- EOSMTP >> nail.rc
+
+ # Use the local sendmail (/usr/sbin/sendmail) binary by default.
+ # (Uncomment the following line to use a SMTP server)
+ #set smtp=localhost
+
+ # Ask for CC: list too.
+ set askcc
+ EOSMTP
+
+ emake DESTDIR="${D}" install
+
+ dodoc INSTALL NEWS README THANKS
+
+ dodir /bin
+ dosym ../usr/bin/mailx /bin/mail
+ dosym s-nail /usr/bin/mailx
+ dosym mailx /usr/bin/mail
+ dosym mailx /usr/bin/Mail
+
+ dosym s-nail.1 /usr/share/man/man1/mailx.1
+ dosym mailx.1 /usr/share/man/man1/mail.1
+ dosym mailx.1 /usr/share/man/man1/Mail.1
+}