Email Change Notification

There are several potential problems that may effect individual wiki installations.

  1. Transient errors may go unnoticed because the error messages are sent to the individual users; there is no log for administrators to review.
  2. Saving a page sometimes takes a (relatively) long time because of delays in the email transmission.
  3. ISPs that require a login to pop3 rather than smtp to send an email are not currently supported.
  4. ISPs that require the the To and From fields in the smtp.send to agree with the To and From fields in the message are not supported.

Steps to reproduce

  1. 1 and 2 above occur in all wikis with email notification turned on. In some wikis it may be of no consequence.
  2. 3 and 4 above occur with Cox Business Services, an example of the output from 3 is below.

Example

Attempts to send email through Cox Business Services fail immediately:

>>> import smtplib
>>> import os
>>> import socket
>>> server = smtplib.SMTP(host, int(port))

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    server = smtplib.SMTP(host, int(port))
  File "c:\Python25\lib\smtplib.py", line 246, in __init__
    raise SMTPConnectError(code, msg)
SMTPConnectError: (421, 'Sorry, you must log in before using this server.')

The above message does not say it very well, but the ISP wants the user to login to pop3, NOT smtp.

>>> import poplib
>>> user,pwd = pop3_login.split()
>>> M.user(user)
+OK please send PASS command
>>> M.pass_(pwd)
+OK xxxx@xxxxxxx.phxcoxmail.com is welcome here
>>> server = smtplib.SMTP(host, int(port))
>>> server.sendmail(mail_from, to, msg)

Component selection

Details

MoinMoin Version

1.5.8

OS and Version

Fedora Core 6, Windows Vista

Python Version

2.4, 2.5

Server Setup

Apache

Server Details

Mod_python

Language you are using the wiki in (set in the browser/UserPreferences)

English

Alternative 1

This is not implemented. In thinking stage, with some fragments tested. Comments welcome.

  1. Change mail.py
    1. write a temporary file to disk rather than send a change notification email
    2. start a subprocess to send the email notifications via a new program emailer.py
    3. return a message to user saying notifications were queued rather than success/failure
  2. Create new emailer.py
    1. move ISP, user name, password from wikiconfig.py to emailer.py
    2. add option for pop3 login
    3. read temporary file and send out notification email, on success delete temporary file, on failure append error message to log file.
  3. wikiconfig.py
    1. add parameters for pointer to directory containing temporary files and subprocess command
    2. remove parameters for ISP, user name, password? -- needed for other things?
  4. new macro
    1. write an EmailLog macro that displays error log (for use on administrator's home page)

  5. new tasks for administrators
    1. inspect error log and the directory for unsent messages, attempt to resend?
    2. check mailbox used for outgoing messages to check for replies/invalid addresses

Alternative 2

There is no need to return a message about mail sent to users. To most users, it does not matter that the wiki sent mail about their edit, and user mail subscriptions should be private. What do matter to most users is to shorten the time they have to wait for the wiki. Removing the mail was sent message will keep everyone happy.

There is no need for a queue of files - there is the editlog, containing all the data you need for the notification. Simply read the editlog backwards and send mail for all edits until the last edit handled. The mailer tool will need to keep the last handled edit id, updated after each mail was sent successfully.

The mailer can run as a cron job, checking for changes in the log every 5-15 minutes (configurable).

For hosted wikis without that can not use cron, start the mailer process at the end of the save request (configurable).

Discussion

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/ChangeNotificationEmail (last edited 2007-10-29 19:20:38 by localhost)