Article 168476 of comp.os.vms:
This is a multi-part message in MIME format.

--------------396CD11D347A0F9225A34D63
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The below is a C program that I wrote years and years ago.
-- 
-----------------------------------------------------------------------
Brian J. McCarthy                  | mailto:mccarthy@hndymn.zko.dec.com
Digital Equipment Corp. Nashua, NH | DEC CRTL/DEC C++ Class Libraries
-----------------------------------------------------------------------

--------------396CD11D347A0F9225A34D63
Content-Type: text/plain; charset=us-ascii; name="SHOW_NEW_MAIL.C.1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="SHOW_NEW_MAIL.C.1"

#include <stdio.h>
#include <dvidef.h>
#include <maildef.h>

extern int mail$user_begin ();
extern int mail$user_end ();

/*
    In case you don't have MAIL.H yet
    #define MAIL$_USER_NEW_MESSAGES 3146
*/

typedef struct _vms_item_list {
	short	 buffer_length;
	short	 item_code;
	void	*buffer;
	int	*returned_buffer_length;
	} VMS_ItemList;


main ()
{
    int mail_context;
    unsigned  short new_messages;
    unsigned int length;

    VMS_ItemList in_itmlst [1] =
	{0, 0, 0, 0};


    VMS_ItemList out_itmlst [1] =
	{2, MAIL$_USER_NEW_MESSAGES, &new_messages, &length};


    mail_context = 0;

    mail$user_begin (&mail_context,
	    in_itmlst,
	    out_itmlst);

    if (new_messages != 1)
	printf ("\tYou have %d new mail messages.", new_messages);
    else
	printf ("\tYou have %d new mail message.", new_messages);

    mail$user_end (&mail_context,
	    in_itmlst,
	    in_itmlst);

}

--------------396CD11D347A0F9225A34D63--



