Index: trunk/src/org/expeditee/auth/Actions.java
===================================================================
--- trunk/src/org/expeditee/auth/Actions.java	(revision 1276)
+++ trunk/src/org/expeditee/auth/Actions.java	(revision 1277)
@@ -21,8 +21,6 @@
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.PKCS8EncodedKeySpec;
-import java.sql.Connection;
-import java.sql.DriverManager;
 import java.sql.SQLException;
-import java.sql.Statement;
+import java.text.ParseException;
 import java.util.Base64;
 import java.util.Collection;
@@ -79,7 +77,5 @@
 		options.put("Neat", "Beep");
 		MailEntry mail = new MailEntry(time, sender, colleagueName, topic, message, options);
-		PublicKey publicKey = Authenticator.getInstance().getPublicKey(colleagueName);
-		Path outbox = Paths.get(FrameIO.PROFILE_PATH).resolve(sender).resolve(sender + "-credentials");
-		Mail.sendMail(mail, publicKey, outbox);
+		Mail.sendMail(mail, colleagueName);
 	}
 	private static String userbackup = "authadmin";
@@ -99,6 +95,7 @@
 	 * @throws FileNotFoundException 
 	 * @throws KeyStoreException 
-	 */
-	public static void MailMode() throws KeyStoreException, FileNotFoundException, NoSuchAlgorithmException, CertificateException, ClassNotFoundException, SQLException, IOException {
+	 * @throws ParseException 
+	 */
+	public static void MailMode() throws KeyStoreException, FileNotFoundException, NoSuchAlgorithmException, CertificateException, ClassNotFoundException, SQLException, IOException, ParseException {
 		if (!DisplayController.isMailMode()) {
 			Mail.clear();
@@ -133,7 +130,8 @@
 	 * @throws InvalidKeySpecException 
 	 * @throws InvalidKeyException 
+	 * @throws ParseException 
 	 * @throws Exception 
 	 */
-	public static void AuthCreateAccount() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, ClassNotFoundException, InvalidFramesetNameException, ExistingFramesetException, IOException, SQLException, InvalidKeyException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
+	public static void AuthCreateAccount() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, ClassNotFoundException, InvalidFramesetNameException, ExistingFramesetException, IOException, SQLException, InvalidKeyException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, ParseException {
 		Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();
 		Optional<Map<AuthenticationTag, String>> userdata = 
@@ -192,6 +190,5 @@
 			login(userdata.get());
 			Authenticator.Authenticated = true;
-		}
-		else {
+		} else {
 			MessageBay.errorMessage(Constants.ERROR_INSUFFICIENT_INFORMATION_PROVIDED);
 		}
@@ -355,9 +352,7 @@
 	 */
 	private static void createAccount(Map<AuthenticationTag, String> userdata) throws InvalidFramesetNameException, ExistingFramesetException, 
-		KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, ClassNotFoundException, IOException, SQLException {
-				
+		KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, ClassNotFoundException, IOException, SQLException {			
 		// Track progress
 		String message = "Creating new user account...";
-		//Progress progress = MessageBay.displayProgress(message);
 
 		// Extract user details
@@ -469,18 +464,4 @@
 		Path destinationFile = destinationDirectory.resolve(Authenticator.CREDENTIALS_FRAME + ExpReader.EXTENTION);
 		FrameIO.migrateFrame(credentialsFrame, destinationFile);
-		//	outbox
-		Connection c = DriverManager.getConnection("jdbc:sqlite:" + credentialsDir.getAbsolutePath() + File.separator + "expmail.db");
-		Statement createTable = c.createStatement();
-		String sql = "CREATE TABLE EXPMAIL (" +
-				"TIME		TEXT					NOT NULL, " +
-				"SND		TEXT					NOT NULL, " + 
-				"REC		TEXT					NOT NULL, " + 
-				"MSG		TEXT					NOT NULL, " +
-				"MSG2		TEXT					NOT NULL, " + 
-				"OPTS		ARRAY					NOT NULL, " +
-				"OPTSVAL	ARRAY					NOT NULL)";
-		createTable.executeUpdate(sql);
-		createTable.close();
-		c.close();
 		
 		System.out.println(message + "Creating Individual Space.");
@@ -492,4 +473,9 @@
 		contactsDir.mkdir();
 		
+		System.out.println(message + "Creating Space For Dead Drops");
+		
+		File deadDropsDir = new File(personalResources.resolve("deaddrops").toAbsolutePath().toString());
+		deadDropsDir.mkdir();
+		
 		System.err.println("**** Hardwired call in Apollo's AuthioPathManager");
 		AudioPathManager.activateAndScanAudioDir(); // ****
@@ -497,11 +483,9 @@
 		System.out.println(message + "Done.");
 	}
-	
-	
 
 	/*
 	 * Function used to authenticate as a specified user (via function arguments).
 	 */
-	private static void login(Map<AuthenticationTag, String> userdata) throws NoSuchAlgorithmException, KeyStoreException, FileNotFoundException, CertificateException, ClassNotFoundException, IOException, SQLException, InvalidKeySpecException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
+	private static void login(Map<AuthenticationTag, String> userdata) throws NoSuchAlgorithmException, KeyStoreException, FileNotFoundException, CertificateException, ClassNotFoundException, IOException, SQLException, InvalidKeySpecException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, ParseException {
 		String username = userdata.get(AuthenticationTag.Username);
 		String password = userdata.get(AuthenticationTag.Password);
@@ -539,4 +523,5 @@
 			personalKeyText.setData(Base64.getEncoder().encodeToString(personalKey.getEncoded()));
 			KeyList.PersonalKey.setSetting(personalKeyText);
+			UserSettings.UserName.set(username);
 			oneFrame = FrameIO.LoadProfile(username);
 			for (int i = 1; i <= FrameIO.getLastNumber(username); i++) {
@@ -608,5 +593,5 @@
 		options.put("Clear Preview Colleague Nominations", "AuthClearPWColleaguesNominated");
 		MailEntry mail = new MailEntry(time, sender, colleagueName, message, message2, options);
-		Mail.sendMail(mail, Authenticator.getInstance().getPublicKey(colleagueName), Paths.get(FrameIO.PROFILE_PATH).resolve(sender).resolve(sender + "-credentials"));
+		Mail.sendMail(mail, colleagueName);
 	}
 	
@@ -631,8 +616,7 @@
 			arguments.put("I wish to excuse myself from this responsibility.", "AuthDenyPasswordColleagueRelationship " + sender);
 			MailEntry mail = new MailEntry(time, sender, colleagueOne, topic, message, arguments);
-			Path outbox = Paths.get(FrameIO.PROFILE_PATH).resolve(sender).resolve(sender + "-credentials");
-			Mail.sendMail(mail, colleagueOneKey, outbox);
+			Mail.sendMail(mail, colleagueOne);
 			mail = new MailEntry(time, sender, colleagueTwo, topic, message, arguments);
-			Mail.sendMail(mail, colleagueTwoKey, outbox);
+			Mail.sendMail(mail, colleagueTwo);
 			Authenticator.getInstance().markRequestedColleagues(UserSettings.UserName.get());
 			return true;
Index: trunk/src/org/expeditee/auth/Authenticator.java
===================================================================
--- trunk/src/org/expeditee/auth/Authenticator.java	(revision 1276)
+++ trunk/src/org/expeditee/auth/Authenticator.java	(revision 1277)
@@ -2,7 +2,9 @@
 
 import java.io.File;
+import java.io.FileFilter;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
@@ -25,8 +27,13 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Base64;
 import java.util.Collection;
+import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Scanner;
@@ -59,4 +66,5 @@
 import org.expeditee.settings.UserSettings;
 import org.expeditee.settings.identity.secrets.KeyList;
+import org.expeditee.stats.Formatter;
 import org.ngikm.cryptography.CryptographyConstants;
 
@@ -172,7 +180,7 @@
 	}
 	
-	final void loadMailFromDirectory(Path contactDir) throws SQLException {
+	final void loadMailFromFile(Path dbFile) throws SQLException {
 		// Load in all mail.
-		Connection c = DriverManager.getConnection("jdbc:sqlite:" + contactDir.resolve("expmail.db"));
+		Connection c = DriverManager.getConnection("jdbc:sqlite:" + dbFile.toAbsolutePath().toString());
 		String sql = "SELECT * FROM EXPMAIL";
 		PreparedStatement query = c.prepareStatement(sql);
@@ -209,24 +217,77 @@
 	}
 	
-	final void loadMailDatabase() throws SQLException {
-		Path contactsPath = Paths.get(FrameIO.CONTACTS_PATH);
-		File[] contacts = contactsPath.toFile().listFiles();
-		for (int i = 0; i < contacts.length; i++) {
-			if (contacts[i].isDirectory()) {
-				Path contact = Paths.get(contacts[i].getAbsolutePath());
-				loadMailFromDirectory(contact);
-			}
-		}
-	}
-	
+	final void loadMailDatabase() throws SQLException, FileNotFoundException, ParseException {
+		Path deadDropPath = Paths.get(FrameIO.DEAD_DROPS_PATH);
+		for (File connectionDir: deadDropPath.toFile().listFiles()) {
+			if (connectionDir.isDirectory()) {
+				Path deaddropforcontactPath = Paths.get(connectionDir.getAbsolutePath());
+				Path dbFile = deaddropforcontactPath.resolve(UserSettings.UserName.get() + ".db");
+				if (dbFile.toFile().exists()) {
+					loadMailFromFile(dbFile);
+				}
+				Path timestamp = deaddropforcontactPath.resolve(UserSettings.UserName.get() + ".last-accessed");
+				try(FileWriter out = new FileWriter(timestamp.toFile())) {
+					out.write(Formatter.getDateTime() + System.getProperty("line.separator"));
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+				clearOldMailFromDatabase(deaddropforcontactPath);
+			}
+		}
+	}
+	
+	private void clearOldMailFromDatabase(Path directory) throws FileNotFoundException, ParseException, SQLException {
+		File[] files = directory.toFile().listFiles(new FileFilter() {
+			@Override
+			public boolean accept(File file) {
+				return !file.getName().startsWith(UserSettings.UserName.get());
+			}
+		});
+		
+		File dbFile = null;
+		File lastAccessedFile = null;
+		for (File file: files) {
+			if (file.getName().endsWith(".db")) {
+				dbFile = file;
+			} else {
+				lastAccessedFile = file;
+			}
+		}
+		
+		if (dbFile == null || lastAccessedFile == null) {
+			System.err.println("Failed to clear old messages from database file.");
+			return; // Not the end of the world if we cannot clear out old messages.
+		}
+		
+		SimpleDateFormat format = new SimpleDateFormat("ddMMMyyyy[HH:mm]");
+		Date timestamp = null;
+		try(Scanner in = new Scanner(lastAccessedFile)) {
+			timestamp = format.parse(in.nextLine());
+		}
+		
+		Connection c = DriverManager.getConnection("jdbc:sqlite:" + dbFile.getAbsolutePath());
+		String sql = "SELECT * FROM EXPMAIL";
+		PreparedStatement query = c.prepareStatement(sql);
+		ResultSet allMail = query.executeQuery();
+		List<String> oldTimestamps = new ArrayList<String>();
+		
+		while (allMail.next()) {
+			String time = allMail.getString("time");
+			Date messageTimestamp = format.parse(time);
+			if (timestamp.after(messageTimestamp)) {
+				oldTimestamps.add(time);
+			}
+		}
+		
+		System.err.println("Found " + oldTimestamps.size() + " messages to delete.");
+		// TODO delete the messages from database.
+	}
+	 
 	final SecretKey getSecretKey(final String label, final String password) throws NoSuchAlgorithmException, KeyStoreException {	
 		
 		char[] password_ca = password.toCharArray();
-		//final KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(password_ca);
 		
 		SecretKey secret_key;
 		try {
-			//SecretKeyEntry entry = (SecretKeyEntry) keyStore.getEntry(label, entryPassword);
-			//secret_key = entry.getSecretKey();
 			secret_key = (SecretKey) keyStore.getKey(label, password_ca);			
 		} catch (final UnrecoverableEntryException e) {
Index: trunk/src/org/expeditee/auth/Mail.java
===================================================================
--- trunk/src/org/expeditee/auth/Mail.java	(revision 1276)
+++ trunk/src/org/expeditee/auth/Mail.java	(revision 1277)
@@ -1,13 +1,20 @@
 package org.expeditee.auth;
 
+import java.io.File;
+import java.io.IOException;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.security.InvalidKeyException;
+import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
 import java.security.PrivateKey;
 import java.security.PublicKey;
+import java.security.cert.CertificateException;
+import java.security.spec.InvalidKeySpecException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -22,4 +29,5 @@
 import javax.crypto.NoSuchPaddingException;
 
+import org.expeditee.gui.FrameIO;
 import org.ngikm.cryptography.CryptographyConstants;
 
@@ -39,11 +47,60 @@
 	}
 	
-	public static void sendMail(MailEntry mail, PublicKey key, Path outbox) {
+	public static void sendMail(MailEntry mail, String colleagueName) {
+		// Ensure dead drop area is set up.
+		Path databaseFileDirPath = Paths.get(FrameIO.DEAD_DROPS_PATH).resolve(colleagueName);
+		Path databaseFilePath = databaseFileDirPath.resolve(colleagueName + ".db");
+		File databaseFile = databaseFilePath.toFile();
+		if (!databaseFile.exists()) {
+			databaseFileDirPath.toFile().mkdirs();
+			String sql = 
+					"CREATE TABLE EXPMAIL (" +
+					"TIME		TEXT					NOT NULL, " +
+					"SND		TEXT					NOT NULL, " + 
+					"REC		TEXT					NOT NULL, " + 
+					"MSG		TEXT					NOT NULL, " +
+					"MSG2		TEXT					NOT NULL, " + 
+					"OPTS		ARRAY					NOT NULL, " +
+					"OPTSVAL	ARRAY					NOT NULL)";
+			try {
+				Connection c = DriverManager.getConnection("jdbc:sqlite:" + databaseFile.getAbsolutePath());
+				Statement createTable = c.createStatement();
+				createTable.executeUpdate(sql);
+				createTable.close();
+				c.close();
+			} catch (SQLException e) {
+				System.err.println("Error while creating database file.");
+				e.printStackTrace();
+			}
+		}
+		
+		// Obtain public key
+		PublicKey publicKey = null;
+		try {
+			publicKey = Authenticator.getInstance().getPublicKey(colleagueName);
+		} catch (InvalidKeySpecException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+				| ClassNotFoundException | IOException | SQLException e) {
+			System.err.println("Error while sending message.  Unable to obtain public key for colleague " +  
+				colleagueName + ".  Exception message: " + e.getMessage());
+			return;
+		}
+		
+		// Check we got public key
+		if (publicKey == null) {
+			System.err.println("Error while sending message.  Unable to obtain public key for colleague.  Have you exchanged contact details?");
+			return;
+		}
+		
+		// Send message
+		sendMail(mail, publicKey, databaseFilePath);
+	}
+	
+	private static void sendMail(MailEntry mail, PublicKey key, Path databaseFile) {
 		try {
 			Cipher cipher = Cipher.getInstance(AsymmetricAlgorithm + AsymmetricAlgorithmParameters);
 			
 			// encrypt the necessary parts of the message
-			cipher.init(Cipher.ENCRYPT_MODE, key);
-			String time = Base64.getEncoder().encodeToString(cipher.doFinal(mail.timestamp.getBytes()));
+			//cipher.init(Cipher.ENCRYPT_MODE, key);
+			//String time = Base64.getEncoder().encodeToString(cipher.doFinal(mail.timestamp.getBytes()));
 			cipher.init(Cipher.ENCRYPT_MODE, key);
 			String sender = Base64.getEncoder().encodeToString(cipher.doFinal(mail.sender.getBytes()));
@@ -65,8 +122,8 @@
 			
 			// write to mail database
-			Connection c = DriverManager.getConnection("jdbc:sqlite:" + outbox.resolve("expmail.db"));
+			Connection c = DriverManager.getConnection("jdbc:sqlite:" + databaseFile);
 			String sql = "INSERT INTO EXPMAIL (TIME,SND,REC,MSG,MSG2,OPTS,OPTSVAL) VALUES (?, ?, ?, ?, ?, ?, ?);";
 			PreparedStatement statement = c.prepareStatement(sql);
-			statement.setString(1, time);
+			statement.setString(1, mail.timestamp);
 			statement.setString(2, sender);
 			statement.setString(3, rec);
@@ -110,6 +167,4 @@
 			if (receiverDecrypted.compareToIgnoreCase(name) == 0) {
 				c.init(Cipher.DECRYPT_MODE, key);
-				String timestamp = new String(c.doFinal(Base64.getDecoder().decode(mail.timestamp)));
-				c.init(Cipher.DECRYPT_MODE, key);
 				String sender = new String(c.doFinal(Base64.getDecoder().decode(mail.sender)));
 				c.init(Cipher.DECRYPT_MODE, key);
@@ -128,5 +183,5 @@
 				
 				//String arguments = new String(c.doFinal(Base64.getDecoder().decode(mail.args)));
-				filtered.add(new MailEntry(timestamp, sender, receiverDecrypted, message, message2, options));
+				filtered.add(new MailEntry(mail.timestamp, sender, receiverDecrypted, message, message2, options));
 			}
 		}
Index: trunk/src/org/expeditee/gui/FrameIO.java
===================================================================
--- trunk/src/org/expeditee/gui/FrameIO.java	(revision 1276)
+++ trunk/src/org/expeditee/gui/FrameIO.java	(revision 1277)
@@ -116,4 +116,5 @@
 	public static String HELP_PRIVATE_PATH;
 	public static String HELP_PATH;
+	public static String DEAD_DROPS_PATH;
 
 	// Paths that appear to be unused.
@@ -139,5 +140,4 @@
 		PUBLIC_PATH = PARENT_FOLDER + "public" + File.separator;
 		TRASH_PATH = PARENT_FOLDER + "trash" + File.separator;
-		//MESSAGES_PATH = PARENT_FOLDER + "messages" + File.separator;
 		HELP_PATH = PARENT_FOLDER + "documentation" + File.separator;
 		PROFILE_PATH = PARENT_FOLDER + "profiles" + File.separator;
@@ -162,4 +162,5 @@
 			AUDIO_PATH = PARENT_FOLDER + "audio" + File.separator;
 			FRAME_PATH = PARENT_FOLDER + "framesets" + File.separator;
+			DEAD_DROPS_PATH = PARENT_FOLDER + "deaddrops" + File.separator;
 		}
 		
@@ -199,4 +200,5 @@
 			MESSAGES_PATH = resourcesPrivateIndividualPath + "messages" + File.separator;
 			MAIL_PATH = resourcesPrivateIndividualPath + "mail" + File.separator;
+			DEAD_DROPS_PATH = resourcesPrivateIndividualPath + "deaddrops" + File.separator;
 		} 
 			
Index: trunk/src/org/expeditee/settings/UserSettings.java
===================================================================
--- trunk/src/org/expeditee/settings/UserSettings.java	(revision 1276)
+++ trunk/src/org/expeditee/settings/UserSettings.java	(revision 1277)
@@ -259,4 +259,5 @@
 			FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.PUBLIC_PATH);
 			FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.HELP_PRIVATE_PATH);
+			FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.MAIL_PATH);
 			FolderSettings.FrameDirs.setDefault(FolderSettings.FrameDirs.get());
 						
@@ -271,5 +272,4 @@
 			FolderSettings.AudioDirs.addAbsoluteDir(FrameIO.AUDIO_PATH);
 			FolderSettings.AudioDirs.setDefault(FolderSettings.AudioDirs.get());
-			
 		} else {
 			FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.FRAME_PATH);
