summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorklm1998-07-23 22:48:17 +0000
committerklm1998-07-23 22:48:17 +0000
commit768be2a5981943c4176fee1d79af8f19028b51d0 (patch)
tree071a0480442115b27d9885652bc9e57b5092fd57
parent609b29fb75b795fb78aef99cf4d793d767f1f276 (diff)
downloadmailman-768be2a5981943c4176fee1d79af8f19028b51d0.tar.gz
mailman-768be2a5981943c4176fee1d79af8f19028b51d0.tar.zst
mailman-768be2a5981943c4176fee1d79af8f19028b51d0.zip
-rwxr-xr-xmail/contact_transport23
1 files changed, 19 insertions, 4 deletions
diff --git a/mail/contact_transport b/mail/contact_transport
index 786cbdae2..544c68f15 100755
--- a/mail/contact_transport
+++ b/mail/contact_transport
@@ -16,10 +16,20 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+"""Send a message via local SMTP, or queue it if SMTP port is not responding.
+
+The script takes the following protocol on stdin:
+
+ line [1]: sender
+ line [2:n+1]: n recipients
+ line [n+2]: <empty> - delimiting end of recipients
+ line [n+3:]: message content
+"""
+
import sys, os
import paths
-# XXX: this REALLY should be merged with Python's standard smtplib library
+# XXX: this really should be merged with Python's standard smtplib library
from Mailman import mm_cfg
from Mailman import smtplib
from Mailman import Utils
@@ -28,10 +38,15 @@ from Mailman import OutgoingQueue
from Mailman.Logging.Utils import LogStdErr
LogStdErr("error", "contact_transport")
-from_addr = sys.argv[1]
-to_addrs = sys.argv[2:]
-
+from_addr = sys.stdin.readline()[:-1]
+to_addrs = []
+while 1:
+ l = sys.stdin.readline()[:-1]
+ if not l:
+ break
+ to_addrs.append(l)
text = sys.stdin.read()
+
queue_id = OutgoingQueue.enqueueMessage(from_addr, to_addrs, text)
Utils.TrySMTPDelivery(to_addrs, from_addr, text, queue_id)
OutgoingQueue.processQueue()