diff --git a/src/sbbs3/atcodes.cpp b/src/sbbs3/atcodes.cpp
index e8318ce72e78e00941947e2a91ec0bdc7beeb2c2..7cae16039d2e3511b7949b23def0a34a1f694dd5 100644
--- a/src/sbbs3/atcodes.cpp
+++ b/src/sbbs3/atcodes.cpp
@@ -1593,6 +1593,16 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode, bool
 		return(tp);
 	}
 
+	if(!strcmp(sp,"MAILR")) {
+		safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number, /* Sent: */FALSE, /* attr: */MSG_READ));
+		return(str);
+	}
+
+	if(!strcmp(sp,"MAILU")) {
+		safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number, /* Sent: */FALSE, /* attr: */~MSG_READ));
+		return(str);
+	}
+
 	if(!strcmp(sp,"MAILW")) {
 		safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number, /* Sent: */FALSE, /* attr: */0));
 		return(str);
@@ -1608,6 +1618,16 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode, bool
 		return(str);
 	}
 
+	if(!strncmp(sp,"MAILR:",6) || !strncmp(sp,"MAILR#",6)) {
+		safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6), /* Sent: */FALSE, /* attr: */MSG_READ));
+		return(str);
+	}
+
+	if(!strncmp(sp,"MAILU:",6) || !strncmp(sp,"MAILU#",6)) {
+		safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6), /* Sent: */FALSE, /* attr: */~MSG_READ));
+		return(str);
+	}
+
 	if(!strncmp(sp,"MAILW:",6) || !strncmp(sp,"MAILW#",6)) {
 		safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6), /* Sent: */FALSE, /* attr: */0));
 		return(str);
diff --git a/src/sbbs3/getmail.c b/src/sbbs3/getmail.c
index a38d14390688dadd0182a0a5ad999cf1d4c8af9b..2dc5b48ce1081375dfa37da126d666b5ee5674bb 100644
--- a/src/sbbs3/getmail.c
+++ b/src/sbbs3/getmail.c
@@ -26,7 +26,7 @@
 /* If sent is non-zero, it returns the number of mail sent by usernumber    */
 /* If usernumber is 0, it returns all mail on the system                    */
 /****************************************************************************/
-int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent, uint16_t attr)
+int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent, int attr)
 {
     char    path[MAX_PATH+1];
     int     i=0;
@@ -55,7 +55,9 @@ int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent, uint16_t attr)
 			continue;
 		if(idx.attr&MSG_DELETE)
 			continue;
-		if((idx.attr&attr) != attr)
+		if(attr < 0 && (idx.attr & (~attr)) != 0)
+			continue;
+		if(attr > 0 && (idx.attr & attr) != attr)
 			continue;
 		if(usernumber == 0
 			|| (!sent && idx.to==usernumber)
diff --git a/src/sbbs3/getmail.h b/src/sbbs3/getmail.h
index 949db78e9d9144527fa0cf72926c3950591e7b3c..2a1f4b0e38944d23b79f69693cafc6ce324d3a1f 100644
--- a/src/sbbs3/getmail.h
+++ b/src/sbbs3/getmail.h
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-DLLEXPORT int		getmail(scfg_t* cfg, int usernumber, BOOL sent, uint16_t attr);
+DLLEXPORT int		getmail(scfg_t* cfg, int usernumber, BOOL sent, int attr);
 DLLEXPORT mail_t *	loadmail(smb_t* smb, uint32_t* msgs, uint usernumber
 							,int which, long mode);
 DLLEXPORT void		freemail(mail_t* mail);
@@ -37,4 +37,4 @@ DLLEXPORT BOOL		delfattach(scfg_t*, smbmsg_t*);
 #ifdef __cplusplus
 }
 #endif
-#endif /* Don't add anything after this line */
\ No newline at end of file
+#endif /* Don't add anything after this line */
diff --git a/src/sbbs3/js_user.c b/src/sbbs3/js_user.c
index f961a2b44e0ca449bed7d115ae7d19c3cff1be0f..39900e7d8463f837cc86d7ac8e2fc07a7b22940e 100644
--- a/src/sbbs3/js_user.c
+++ b/src/sbbs3/js_user.c
@@ -1,7 +1,4 @@
 /* Synchronet JavaScript "User" Object */
-// vi: tabstop=4
-
-/* $Id: js_user.c,v 1.119 2020/08/11 03:54:58 rswindell Exp $ */
 
 /****************************************************************************
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
@@ -16,21 +13,9 @@
  * See the GNU General Public License for more details: gpl.txt or			*
  * http://www.fsf.org/copyleft/gpl.html										*
  *																			*
- * Anonymous FTP access to the most recent released source is available at	*
- * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net	*
- *																			*
- * Anonymous CVS access to the development source and modification history	*
- * is available at cvs.synchro.net:/cvsroot/sbbs, example:					*
- * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login			*
- *     (just hit return, no password is necessary)							*
- * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src		*
- *																			*
  * For Synchronet coding style and modification guidelines, see				*
  * http://www.synchro.net/source.html										*
  *																			*
- * You are encouraged to submit any modifications (preferably in Unix diff	*
- * format) via e-mail to mods@synchro.net									*
- *																			*
  * Note: If this box doesn't appear square, then you need to fix your tabs.	*
  ****************************************************************************/
 
@@ -88,6 +73,9 @@ enum {
 	,USER_PROP_ETODAY	
 	,USER_PROP_PTODAY
 	,USER_PROP_MAIL_WAITING
+	,USER_PROP_READ_WAITING
+	,USER_PROP_UNREAD_WAITING
+	,USER_PROP_SPAM_WAITING
 	,USER_PROP_MAIL_PENDING
 	,USER_PROP_ULB       
 	,USER_PROP_ULS       
@@ -391,7 +379,16 @@ static JSBool js_user_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 			val=scfg->level_freecdtperday[p->user->level];
 			break;
 		case USER_PROP_MAIL_WAITING:
-			val=getmail(scfg,p->user->number,/* sent? */FALSE, /* SPAM: */FALSE);
+			val=getmail(scfg,p->user->number,/* sent? */FALSE, /* attr: */0);
+			break;
+		case USER_PROP_READ_WAITING:
+			val=getmail(scfg,p->user->number,/* sent? */FALSE, /* attr: */MSG_READ);
+			break;
+		case USER_PROP_UNREAD_WAITING:
+			val=getmail(scfg,p->user->number,/* sent? */FALSE, /* attr: */~MSG_READ);
+			break;
+		case USER_PROP_SPAM_WAITING:
+			val=getmail(scfg,p->user->number,/* sent? */FALSE, /* attr: */MSG_SPAM);
 			break;
 		case USER_PROP_MAIL_PENDING:
 			val=getmail(scfg,p->user->number,/* sent? */TRUE, /* SPAM: */FALSE);
@@ -960,6 +957,9 @@ static jsSyncPropertySpec js_user_stats_properties[] = {
 	{	"files_downloaded"	,USER_PROP_DLS        	,USER_PROP_FLAGS,		310 },
 	{	"leech_attempts"	,USER_PROP_LEECH 	 	,USER_PROP_FLAGS,		310 },
 	{	"mail_waiting"		,USER_PROP_MAIL_WAITING	,USER_PROP_FLAGS,		312	},
+	{	"read_mail_waiting"	,USER_PROP_READ_WAITING	,USER_PROP_FLAGS,		31802 },
+	{	"unread_mail_waiting",USER_PROP_UNREAD_WAITING,USER_PROP_FLAGS,		31802 },
+	{	"spam_waiting"		,USER_PROP_SPAM_WAITING	,USER_PROP_FLAGS,		31802 },
 	{	"mail_pending"		,USER_PROP_MAIL_PENDING	,USER_PROP_FLAGS,		312	},
 	{0}
 };
@@ -984,7 +984,10 @@ static char* user_stats_prop_desc[] = {
 	,"total bytes downloaded"
 	,"total files downloaded"
 	,"suspected leech downloads"
-	,"number of e-mail messages currently waiting"
+	,"total number of e-mail messages currently waiting in inbox"
+	,"number of read e-mail messages currently waiting in inbox"
+	,"number of unread e-mail messages currently waiting in inbox"
+	,"number of SPAM e-mail messages currently waiting in inbox"
 	,"number of e-mail messages sent, currently pending deletion"
 	,NULL
 };