NAME

lastmsg - last(1) semblance for your inbox

SYNOPSIS

# in ~/.lastmsgrc
inbox:
  - /home/MGV/mail/inbox
  - /home/MGV/mail/folder
sent:
  - /home/MGV/mail/sent
track:
  bestfriend:
    - best@friend.com
    - best.friend@freemail.com
  someguy: SOMEGUY@cpan.org
  nobody:
    - nobody@example.com

# in your shell
mgv@somehost ~ $ lastmsg
bestfriend best@friend.com  Sat 31 Dec 2016 12:34:56 EET
someguy    SOMEGUY@cpan.org Thu 20 Nov 2016 12:00:00 EET
nobody                      NOT FOUND

DESCRIPTION

lastmsg reads your mail folders looking for emails you exchanged with a given set of people. Then for each person in the set it prints the time you last received an email from or sent an email to them and the email address used.

The script takes no arguments (the settings are taken from a configuration file), and it prints a three-column table where the first column is the ID of a person, the second column is the email address last used (empty if you've never exchanged an email with that person), and the last column is the date of last contact (or the string NOT FOUND if you've never exchanged an email). The rows are sorted by date of last contact (with the most recently contacted people at the top), and the people that you've never exchanged an email with are at the end.

The configuration is in YAML format. Three keys are recognised:

inbox

The path(s) to your inbox and other incoming mail folders (a single string or a list of strings). The From field of these emails is scanned.

If not provided, it defaults to /var/mail/$ENV{USER} and $ENV{HOME}/Maildir/.

NOTE: See Email::FolderType for information on how the type of a folder is identified. In short, the suffix of the folder is analyzed: If /, the format is Maildir. If /., the format is MH. If //, the format is Ezmlm. Otherwise, some heuristics are checked and the fallback is Mbox.

sent

The path(s) to your sent and other outgoing mail folders (a single string or a list of strings). The To, Cc, and Bcc fields of these emails are scanned.

If not provided, it default to an empty list. See NOTE: above for information on how the type of a folder is identified.

track

A hash of people to track. Each entry represents a person. The key is the ID of that person (used for display), and the value is the email address of that person or a list of email addresses of that person.

If not provided, the script will die with an error.

The configuration file can be named lastmsgconfig, lastmsg.config, lastmsgrc, or .lastmsgrc and can be placed in the current directory, in your home directory, in /etc/, and in /usr/local/etc/. See Config::Auto for more information.

ENVIRONMENT

The only recognised environment variable is LASTMSG_DEBUG, which if set to a true value causes the script to emit a lot of information about what it is doing.

TODO

Should handle IRC and IM logs as well, not just emails. Should have better tests.

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2016 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.