Browse Source

refactor responses and add response for BADREQUEST

Pi 1 year ago
parent
commit
37c87a3253

+ 0 - 0
cropswap-members@shandan.one/SUBSCRIBE.eml → cropswap-members@shandan.one/SUBSCRIBE.html


+ 0 - 0
cropswap-members@shandan.one/UNSUBSCRIBE.eml → cropswap-members@shandan.one/UNSUBSCRIBE.html


+ 0 - 2
cropswap-reply.sh

@@ -3,8 +3,6 @@ SENDMAIL=/usr/sbin/sendmail
 if ((DEBUG != 0)); then
 	SENDMAIL="$DEBUGMAIL"
 fi
-#set -x
-	#-A "Content-Transfer-Encoding: 8bit" \
 /usr/bin/mailbot -N -c utf-8 -t "$RESP" \
 	-A "MIME-Version: 1.0" \
 	-A "Content-Type: text/html" \

+ 0 - 0
cropswap@shandan.one/SUBSCRIBE.eml → cropswap@shandan.one/SUBSCRIBE.html


+ 0 - 0
cropswap@shandan.one/UNSUBSCRIBE.eml → cropswap@shandan.one/UNSUBSCRIBE.html


+ 0 - 8
filters/postmaster@localhost

@@ -63,14 +63,6 @@ if ($DISPATCH)
       exit
    }
    gdbmclose
-   if ($AUTH eq "admin")
-   {
-      SUBSCRIBE="SUBSCRIBE"
-   }
-   else
-   {
-      SUBSCRIBE="UNSUBSCRIBE"
-   }
    if ($EXITCODE)
    {
       cc "|$DEBUGMAIL 'auth-sub-fail'"

+ 1 - 1
filters/subscriptions

@@ -28,7 +28,7 @@ if ($DISPATCH)
       {
          exit
       }
-      RESP="$SUBUNSUBRESPDIR/$MAILGROUP/$SUBSCRIBE.eml"
+      RESP="$SUBUNSUBRESPDIR/$MAILGROUP/$SUBSCRIBE.html"
       to "|$MAILBOT"
    }
 }

+ 15 - 3
maildroprc

@@ -10,6 +10,7 @@ SENDMAIL="/opt/cropswap/sendmail.sh"
 DEBUGMAIL="/opt/cropswap/debug.sh"
 MAILBOT="/opt/cropswap/mailbot.sh"
 FILTERDIR="/opt/cropswap/filters"
+RESPDIR="/opt/cropswap/responses"
 MAILDROPDIR="/var/mail/maildrop"
 DEBUG=($DEBUG != 0)
 TEST=($TEST != 0)
@@ -58,23 +59,34 @@ if ($FORMEMBER && $FORORGANIZER)
 {
    EXITCODE=$BADREQUEST
    cc "|$DEBUGMAIL multiple-mail-group-set"
-   exit
 }
 
 if ($MAILGROUP eq "")
 {
    EXITCODE=$BADREQUEST
    cc "|$DEBUGMAIL no-mail-group-set"
-   exit
 }
 
 if (!$CONTINUE)
 {
    EXITCODE=$UNHANDLED
    cc "|$DEBUGMAIL no-continue"
-   exit
 }
 
+if ($EXITCODE != 0)
+{
+   if ($TOPOSTASTER)
+   {
+      exit
+   }
+   else
+   {
+      RESP="$RESPDIR/$EXITCODE.html"
+      to "|$MAILBOT"
+   }
+}
+
+
 LISTDIR="$MAILDROPDIR/$MAILGROUP"
 MLIST="$LISTDIR/mlist"
 SLIST="$LISTDIR/slist"

+ 5 - 0
responses/4.html

@@ -0,0 +1,5 @@
+<html><head></head><body>
+<p>Mail may not be sent to <strong>both</strong> <a href="mailto:cropswap@shandan.one">cropswap@shandan.one</a> and <a href="cropswap-members@shandan.one">cropswap-members@shandan.one</a>
+<p>If you intended your mail to reach the <a href="mailto:cropswap@shandan.one">Taupiri Crop Swap Organizers</a>, then you must ensure <strong>only</strong> <a href="mailto:cropswap@shandan.one">cropswap@shandan.one</a> appears in the To or CC
+<p>If you intended your mail to be delivered to <strong>all</strong> <a href="mailto:cropswap-members@shandan.one">Taupiri Crop Swap Members</a>, then you must ensure <strong>only</strong> <a href="cropswap-members@shandan.one">cropswap-members@shandan.one</a> appears in the To or CC
+</body></html>