Author: dbkr Date: 2006-08-06 16:02:08 +0000 (Sun, 06 Aug 2006) New Revision: 9941
Modified: trunk/apps/Freemail/README trunk/apps/Freemail/src/freemail/AccountManager.java Log: Send welcome / new address messages, and update README Modified: trunk/apps/Freemail/README =================================================================== --- trunk/apps/Freemail/README 2006-08-06 13:40:16 UTC (rev 9940) +++ trunk/apps/Freemail/README 2006-08-06 16:02:08 UTC (rev 9941) @@ -1,52 +1,40 @@ -This is the start of an email-over-Freenet 0.7 implementation. It's by no means -finished yet, and hence is only provided as source through subversion. +Thanks for trying Freemail! -Currently only 'NIM Mode' is supported, 'NIM' coming from the concept of a -'nearly instant message' which was simply messages posted to KSKs, usually -used on freesites in older versions of Freenet. I'd also suggest 'Notably -Insecure Messaging'. It's not secure. At all. Anyone can read your mail. -You can use PGP or equivalent, but it's still easy to spam and hijack -addresses and whatnot. +This is the first release of Freemail, and so may (read: does) have bugs that I haven't found yet. Please do report them at http://bugs.freenetproject.org/. -Proper, secure implemenations of the Freemail protocol will come later. +Using Freemail +============== +You can compile from source: -All the data, including your passwd file, will most likley end up world -readable. Under unix, you could try running Freemail with a modified umask -if this bothers you, but I don't believe there is a portable way of doing -this in Java (or I haven't found it). - -Finally, there *will* be backwards incompatable changes, so don't get -attatched to anything just yet. - -Now you've read that (you have read that, right?): - compile: (however you compile Java, an ant buildfile is supplied) run with --newaccount <account name> to create an account, eg: -java -cp build/ freemail.Freemail --newaccount fred +...or you can fetch the most recent Freemail jar from: http://downloads.freenetproject.org/alpha/Freemail/Freemail.jar +Once you've done one of those steps, create an account (replace java -jar with however you run jar files on your system): + +java -jar Freemail.jar --newaccount fred + Use --passwd <account> <passwd> to set your password -java -cp build/ freemail.Freemail --passwd fred fredspassword +java -jar Freemail.jar --passwd fred fredspassword Run: -java -cp build/ Freemail.FNMail +java -jar Freemail.jar +(You can also specify the address and port of your Freenet node using -h and -p +respectively, if they are not the defaults). + Set up your email client to point at IMAP port 3143 and SMTP port 3025. -Your address is <accountname>@nim.Freemail +You can get a short address by doing: -And yes, in case you were wondering, no - there's nothing to stop someone -else using the same address. I did say it was insecure ;) +java -jar Freemail.jar --shortaddress bob bobshome -Send me a message if you like, I promise to reply if it works :) +...which will give you the address <anything>@bobshome.freemail -dbkr at nim.Freemail -(and since anyone can read Freemail messages right now, my Freemail public key -can be found at USK at vjETpEgDH-6EzlngZoO8KgOZm-B8AAlvZ-6oP6aQmow,DZYYfhpOxIrtdCNJiflIPjd0Qy8nA1d3Dwy86dcdhu0,AQABAAE/dbkr/10/contact/pubkey.fnmail.asc, or failing that, http://accidentalegg.co.uk/contact/pubkey.fnmail) +Feel free to Freemail me on dave at dbkr.freemail! If that doesn't work, my real email address is dbkr at freenetproject.org. -If it doesn't, dbkr at freenetproject.org! - Good luck! Modified: trunk/apps/Freemail/src/freemail/AccountManager.java =================================================================== --- trunk/apps/Freemail/src/freemail/AccountManager.java 2006-08-06 13:40:16 UTC (rev 9940) +++ trunk/apps/Freemail/src/freemail/AccountManager.java 2006-08-06 16:02:08 UTC (rev 9941) @@ -2,9 +2,12 @@ import java.io.File; import java.io.PrintWriter; +import java.io.PrintStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Random; +import java.util.Date; +import java.text.SimpleDateFormat; import java.security.SecureRandom; import java.math.BigInteger; import java.net.MalformedURLException; @@ -48,7 +51,9 @@ File accountdir = new File(DATADIR, username); if (!accountdir.mkdir()) throw new IOException("Failed to create directory "+username+" in "+DATADIR); - getAccountFile(accountdir); + PropsFile accfile = getAccountFile(accountdir); + + putWelcomeMessage(username, getFreemailAddress(accountdir)); } public static void setupNIM(String username) throws IOException { @@ -218,6 +223,34 @@ if (ms.insertAlias(alias)) { accfile.put("domain_alias", alias); + + SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss Z"); + EmailAddress to = getKSKFreemailAddress(accountdir); + + MessageBank mb = new MessageBank(username); + + MailMessage m = mb.createMessage(); + + m.addHeader("From", "Freemail Daemon <nowhere at dontreply>"); + m.addHeader("To", to.toString()); + m.addHeader("Subject", "Your New Address"); + m.addHeader("Date", sdf.format(new Date())); + m.addHeader("Content-Type", "text/plain;charset=\"us-ascii\""); + m.addHeader("Content-Transfer-Encoding", "7bit"); + m.addHeader("Content-Disposition", "inline"); + + PrintStream ps = m.writeHeadersAndGetStream(); + + ps.println("Hi!"); + ps.println(""); + ps.println("This is to inform you that your new short Freemail address is:"); + ps.println(""); + ps.println(to); + ps.println(""); + ps.println("Your long Freemail address will continue to work. If you have had previous short addresses, you should not rely on them working any longer."); + + + m.commit(); } } @@ -252,4 +285,47 @@ if (username.matches("[\\w_]*")) return true; return false; } + + private static void putWelcomeMessage(String username, EmailAddress to) throws IOException { + SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss Z"); + + MessageBank mb = new MessageBank(username); + + MailMessage m = mb.createMessage(); + + m.addHeader("From", "Dave Baker <dave at dbkr.freemail>"); + m.addHeader("To", to.toString()); + m.addHeader("Subject", "Welcome to Freemail!"); + m.addHeader("Date", sdf.format(new Date())); + m.addHeader("Content-Type", "text/plain;charset=\"us-ascii\""); + m.addHeader("Content-Transfer-Encoding", "7bit"); + m.addHeader("Content-Disposition", "inline"); + + PrintStream ps = m.writeHeadersAndGetStream(); + + ps.println("Welcome to Freemail!"); + ps.println(""); + ps.println("Thanks for downloading and testing Freemail. You can get started and send me a Freemail now by hitting 'reply'."); + ps.println("Your new Freemail address is:"); + ps.println(""); + ps.println(to); + ps.println(""); + ps.println("But you'll probably want a shorter one. To do this, run Freemail with the --shortaddress argument, followed by your account name and the part you'd like before the '.freemail'. For example:"); + ps.println(""); + ps.println("java -jar freemail.jar --shortaddress bob bobshouse"); + ps.println(""); + ps.println("Try to pick something unique - Freemail will tell you if somebody has already taken the address you want. These short addresses are *probably* secure, but not absolutely. If you want to be sure, use the long address."); + ps.println(""); + ps.println("If you find a bug, or would like something changed in Freemail, visit our bug tracker at https://bugs.freenetproject.org/(and select 'Freemail' in the top right). You can also drop into #freemail on irc.freenode.net to discuss, or sign up tp the mailing list at http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail."); + ps.println(""); + ps.println("Happy Freemailing!"); + ps.println(""); + ps.println(""); + ps.println(""); + ps.println(""); + ps.println("Dave Baker"); + ps.println("(Freemail developer)"); + + m.commit(); + } }
