Retrieve Last Login of email account via IMAP / POP3 / WEBMAIL

Posted on 2007-08-01
Last Modified: 2013-12-17

I'm looking to programmatically retrieve the last login date of a particular email account via IMAP, POP3, or the webmail client that we offer. I'm failry sure I can figure out the webmail client thing myself, but where I'm stuck is IMAP and POP3.

We use courier for IMAP and postfix for POP3 on a linux box. I need any kind of a command or something to retrieve either all logins and the date the logged in, or per account and I'll look through them myself.

I've been looking on the internet and I've seen nothing that is even remotely close. I'm not a very good googler =P

Any help would be mucho appreciated. Thank you!

(ill be responding to this topic very quickly, so dont go anywhere!)

P.S. We use squirrelmail as our webmail client.
Question by:digitalpacman
    LVL 25

    Accepted Solution

    postfix isn't a pop3 server, its smtp only

    I use courier as well, but it depends where the syslog conf file is configured to deliver those log messages
    cat /etc/syslog.conf | grep mail
    will tell you where to look
    then what I do is this
    cat <<log file>> | egrep "(imapd|pop3d)" | grep <<username>> | tail -1
    not elegant, but it gets the job done for me.  then if you wanted to you could make that into a bash script where it accepts one parameter, the username, for easier usage later.

    Author Comment

    Thanks I will try that tommorow... well my sysadmin is what told me these things are. I'm a programmer.. so I just write their perl scripts and assist in hardware/software changes.. but only theoritical I don't deal in that world.

    But thanks I'll try that hopefully it works my boss is ridin me hard for this =p

    (we are reaching max diskspace so we need to write a cleanup script that disables unused accounts)

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
    Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now