diff options
| author | viega | 1998-07-20 22:16:05 +0000 |
|---|---|---|
| committer | viega | 1998-07-20 22:16:05 +0000 |
| commit | 28aec5d67fa82527bbff4667ee491f86d4c308d3 (patch) | |
| tree | 2baaa2dc969697b7698ebb8a1a56c2164e030bc4 /Mailman/Utils.py | |
| parent | 96d5b20976bb868abebeb94abd420ab4d8757f51 (diff) | |
| download | mailman-28aec5d67fa82527bbff4667ee491f86d4c308d3.tar.gz mailman-28aec5d67fa82527bbff4667ee491f86d4c308d3.tar.zst mailman-28aec5d67fa82527bbff4667ee491f86d4c308d3.zip | |
Wrapped the call to smtplib with some queueing code.
There's a new crontab entry that checks the queue once every 30 mins.
Diffstat (limited to 'Mailman/Utils.py')
| -rw-r--r-- | Mailman/Utils.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 6a6315b60..ff927a5c8 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -163,7 +163,6 @@ def DeliverToUser(msg, recipient, add_headers=[]): # hang pending release of the lock - deadlock. if os.fork(): return - import smtplib sender = msg.GetSender() try: @@ -179,13 +178,26 @@ def DeliverToUser(msg, recipient, add_headers=[]): msg.headers.append(i) text = string.join(msg.headers, '')+ '\n'+ QuotePeriods(msg.body) + import OutgoingQueue + OutgoingQueue.enqueueMessage(sender, recipient, text) + TrySMTPDelivery(recipient,sender,text,queue_id) + # Just in case there's still something waiting to be sent... + OutgoingQueue.processQueue() + finally: + os._exit(0) + +def TrySMTPDelivery(recipient, sender, text, queue_entry): + import smtplib + try: con = smtplib.SmtpConnection(mm_cfg.SMTPHOST) con.helo(mm_cfg.DEFAULT_HOST_NAME) con.send(to=recipient,frm=sender,text=text) con.quit() + import OutgoingQueue + OutgoingQueue.dequeueMessage(queue_entry) finally: - os._exit(0) - +# except: # Todo: This might want to handle special cases. + pass # Just try again later. def QuotePeriods(text): return string.join(string.split(text, '\n.\n'), '\n .\n') |
