2009-05-16 Oddmuse Mail Subscription Dubious
I’m thinking about adding mail subscription to Oddmuse. I used to oppose this, claiming that people should use rss2email and similar feed subscriptions as a replacement. I changed my mind when I joined the RPG Bloggers. I read a lot of posts from blogs I’m not subscribed to. When I leave a comment, I’m interested in getting notified of replies to this one post only. Email just works.
Plan
Visitors can add their email address and click a checkbox to subscribe to changes when they edit a page. The requirement to successfully edit a page acts as a defense mechanism against spammers and vandals (SoftSecurity).
Email addresses are stored in a file. Each mail contains an unsubscribe link, and from there users can see (and unsubscribe from) all other pages they are subscribed to. The link contains a hash of the email address which prevents others from guessing what email addresses have subscriptions.
There is also an admin interface that shows which email addresses are subscribed to which pages, allowing the easy removal of email addresses from the database.
Perl
The problem was that on my host, there is no C compiler, so I was unable to install Email::Sender. The web processes also run in an environment without access to sendmail. Net::SMTP does not support Transport Layer Security (TLS). Googling around I found a “Simple SMTP client with STARTTLS and AUTH support” by Michal Ludvig: Command line SMTP client.
On my Mac OS 10.4 system at home, I wasted a lot of time trying to install Bundle::CPAN. Gaaah! Some dependencies were not automatic, but a few good invocations of reports on the CPAN command-line followed by manual installation of the missing package did the job.
I also needed to install IO::Socket::SSL with all its dependencies. Yuck! And it turns out that there is a dependency on Net::SSLeay, which needs a C compiler to build.
Thus, the command-line script will also not do for me!
In the end, I think I will ask them to install libemail-send-perl and libnet-smtp-ssl-perl for Email::Send and Net::SMTP::SSL; there is also Email::Send::Gmail but no corresponding Debian package. We’ll see; I might get it to work without.
Anyway, I decided to invest some time into coding an Oddmuse extension. I was all enthusiastic about it. But now I spent hours fooling around with Perl installations and test programs, I think I will stop it now and read a book or something.
Bummer.
Oddmuse Sends No Email
Thinking about it some more, sending mail after an edit might work for comment submission on comment pages, but it will never work for edits to ordinary pages. So right now I’m working on code that lets me subscribe and unsubscribe from pages, and a computer-readable output of said data. Then I will use a cron-job to send the appropriate emails.
2007-07-27 Mail Routing
I wanted to test my various redirection and forwarding schemes in place…
for m in alex@gnu.org alex@emacswiki.org kensanata@gmail.com aschroeder@thinkmo.de alex.schroeder@openlaw.ch; do echo test | mail -s $m $m; done
And a bit later:
| Alex Schroeder | aschroeder@thinkmo.de - test | 12:35 pm |
| Alex Schroeder | alex@emacswiki.org - test | 12:32 pm |
| Alex Schroeder | alex.schroeder@openlaw.ch - test | 12:31 pm |
| Alex Schroeder | kensanata@gmail.com - test | 12:25 pm |
| Alex Schroeder | alex@gnu.org - test | 12:25 pm |
I sent this from a FSF account, and surprisingly the mails that had to round trip via Europe took several minutes longer. Somehow I’ve gotten used to the idea that geographical distance is no longer relevant. Internet distance is measured in bandwidth and data congestion, not in kilometers travelled.
Tags: Mail
2007-06-23 Gmail Fetch Problems
I use Gmail for my private emails. Google’s spam filter was the easiest to use (no setup required) and worked the best. You can also fetch mail from other accounts using POP3. This feature doesn’t really work for me. Every month or so I discover that my Emails are not being fetched. What is going on?
Looking at Gmail → Settings → Accounts → View history:
| Sat, Jun 23, 2007 at 7:37 PM | 200 mails fetched. 2357 mails remaining. |
| Sat, Jun 9, 2007 at 10:26 AM | No mails fetched. |
| Sat, Jun 9, 2007 at 10:17 AM | 2 mails fetched. |
| Sat, Jun 9, 2007 at 10:12 AM | One mail fetched. |
| Sat, Jun 9, 2007 at 10:07 AM | 2 mails fetched. |
This is useless.
So I contacted ThomasWaldmann who runs thinkmo.de which hosts emacswiki.org, and asked for advice.
We had the following LDAP entry:
dn: mail=alex@emacswiki.org,ou=Mail,dc=thinkmo,dc=de objectClass: mailAccount objectClass: mail mail: alex@emacswiki.org gidNumber: 20008 uidNumber: 20008 mailDirectory: /srv/org.emacswiki/mail/alex/ homeDirectory: /srv/org.emacswiki/mail/alex/
We replaced it with the following:
dn: mail=alex@emacswiki.org,ou=Mail,dc=thinkmo,dc=de objectClass: mailAlias objectClass: mail mail: alex@emacswiki.org mailDrop: alex@gnu.org
I then got a 10MB tarball of /srv/org.emacswiki/mail/alex/ including a directory call ‘cur’ containing what looks to be one file per Email. What would be the easiest way to read them? I’d love to import them into ThunderBird and use my existing spam-filters on them.
Well, first things first. I knew that the subject line of these mails contained the string ***SPAM*** so I unpacked the tarball, changed into the directory with all the files and ran this little command:
for f in `grep -lF "***SPAM***" *`; do rm "$f"; done
-l prints only the file names that match and -F treats the pattern as a fixed string instead of a regular expression.
That reduced the number of candidates to 161. 
I tried using Emacs! I knew that Gnus could read and write Email in various formats. So here we go. Start Emacs. Run M-x gnus. Answer ‘y’ to Unable to open nntp:news, go offline? (y or n) and answer ‘y’ to nntp (news) open error: ''. Continue? (y or n) – I don’t care about news right now.
I must have some Gnus data lying around. My *Group* buffer listed two groups: SPAM and BACKUP. I have no idea.
The last messages are from 2006-05-17. I guess I don’t need them anymore. Use ‘c’ to “catch up”.
Now, I need to create a group that uses my directory as a source… gnus-group-make-directory-group looks like a good candidate: “The user will be prompted for a directory. The contents of this directory will be used as a newsgroup. The directory should contain mail messages or news articles in files that have numeric names.”
Damn the numeric names! 
I get Group nndir:/Users/alex/Documents/Mail/alex/cur contains no messages.
I wrote a little script called number-files:
#!/bin/sh
NUM=1
for f in "$@"; do
echo mv "$f" $NUM
(( NUM++ ))
done
Calling number-files * was looking good, so I called number-files * | sh. I like double-checking my commands. (As Pierre noted in the comments, this breaks if the filenames contain spaces!)
I got 161 files named “1” to “161”. Still looking good!
Back to Gnus and ‘G d’ to create that directory group.
Hah! It worked!
Now to export it to mbox format…
- Use ‘M P a’ to mark all articles with the process mark.
- Use ‘C-o’ to write it to a “Unix mail box file”. Too bad this required me to hit
RET161 times. Next time, I need a command without a confirmation question. Gah!
(Update: A helpful visitor suggested setting gnus-prompt-before-saving to t before using before using ‘C-o’.)
Anyway, I used ~/mbox as the output file, and everything is still looking good. A bit less than 4MB of spam to go.
So, where to I put this?
- Find the Thunderbird directory. On my Mac, it is
/Users/alex/Library/Thunderbird/Profiles/0skwxq1c.default/Mail/Local Folders. - Move the mbox file there. I also renamed it to “Mbox”.

- Start or restart Thunderbird.
- Find your new folder in the “Local Folders” section.
- Use “Apply Junk Filter to the Current Folder” from the “Extras” menu. (I’m translating from German to English, so your menu entry might have a slightly different name.)
Hah, done!
Except that now I have to read all the old mail and apologize for my Email problems. 
2007-02-25 Google Won
I’m forwarding all my mail to alex@gnu.org and alex@emacswiki.org to my Gmail account. I realized I didn’t want to start Thunderbird anymore. Having to sift through a dozen spam mails just to find the occasional mail I cared about turned me off. I ended up reading those mails about once a week. No good.
Comments on 2007-02-25 Google Won
I was using Thunderbird for a while, but I got too frustrated dealing with maintaining mail filters. Whenever I automatically created a mail filter, it put it on the wrong account by default. So I’d have to delete it, and then recreate it manually, each time. Thunderbird is not to mail what Firefox is to web browsing!
– LionKimbro 2007-02-26 16:19 UTC
Too be honest, I never quite understood these per-account rules. It seems to work in the office, but I can’t be bothered (anymore) to think it through at home.
– AlexSchroeder 2007-02-26 17:07 UTC
2006-06-19 Spam Statistics on the O'Reilly Radar
The O'Reilly Radar has a mail by the mail admin showing how much crap their mail server is handling. [1]


“Calling number-files * was looking good, so I called number-files * | sh. I like double-checking my commands.
”
Take care though, you break your otherwise correctly quoted script by piping it to sh and it will fail for filenames containing spaces
– PierreGaston 2007-06-24 05:43 UTC
Ah… Interesting. I hadn’t considered this. Luckily for me, no problem.
– AlexSchroeder 2007-06-24 09:26 UTC
Add Comment