diff --git a/lib/session.php b/lib/session.php
index f462039fb155d1df4ad3de219e3238b47883a4ed..49a124fa67145a5a52803990be469284a8abf52f 100644
--- a/lib/session.php
+++ b/lib/session.php
@@ -222,11 +222,14 @@ private $datahash='';		// hash of data field
 		ldap_close($ldap);
 
 		// Check the user's email status
-		$mailstat = @stat("/var/spool/mail/".$user);
+		/*$mailstat = @stat("/var/spool/mail/".$user);
 		if ($mailstat[size]>0) {
 			if ($mailstat[mtime]>$mailstat[atime]) $this->email = 2;
 			else $this->email = 1;
-		}
+		}*/
+		// a sure-fire way to check to see if the user has any unread email
+		// the bash script returns 0 for no and 1 for yes, takes one arg, username
+		$this->email = shell_exec("/home/member/imranh/bin/sucsunreadmail $user");
 
 		if (file_exists($info['homedirectory'][0]."/.forward")) {
 			$forward = file($info['homedirectory'][0]."/.forward");
diff --git a/templates/login.tpl b/templates/login.tpl
index 28635ad49fc05f8f36f95455cd7b07fc320bdaeb..f1fdfdd717115848327fac6fd535985060ec94be 100644
--- a/templates/login.tpl
+++ b/templates/login.tpl
@@ -2,27 +2,19 @@
 				<form method="post" action="{$ssl_url|escape:'htmlall'}{getparams gets=$gets}">
 					<div>
 {if $session->loggedin}
-Logged in as <a href="{$baseurl}/Community/Members/{$session->username}">{$session->username}</a><br />
-<a href="{$baseurl}/Options">Membership Options</a><br />
+	Logged in as <a href="{$baseurl}/Community/Members/{$session->username}">{$session->username}</a><br />
+	<a href="{$baseurl}/Options">Membership Options</a><br />
+	{if $session->email_forward}
+		Mail forwarded to {$session->email_forward}<br />
+	{else}
+		{if $session->email=="0"}
+			No new email<br />
+		{elseif $session->email=="1"}
+			<a href="https://sucs.org/webmail/">New email</a><br />
+		{/if}
 
-{if $session->email_forward}
-Mail forwarded to {$session->email_forward}<br />
-
-
-{* Don't bother alerting users to new mail at present; it's all broken because of noatime
-{else}
-{if $session->email=="0"}
-No email<br />
-{elseif $session->email=="1"}
-No new email<br />
-{elseif $session->email=="2"}
-<a href="https://sucs.org/webmail/">New email</a><br />
-{/if}
-*}
-
-{/if}
-
-					<input type="submit" class="button" name="Logout" id="Logout" value="Logout" />
+	{/if}
+	<input type="submit" class="button" name="Logout" id="Logout" value="Logout" />
 {else}
 					<input type="text" class="text" name="session_user" id="session_user" placeholder="Username" />
 					<input type="password" class="text" name="session_pass" id="session_pass" placeholder="Password" />