I'm trying to find a way to add "page X of Y" to the footers of my scrlttr2 letters. At first sight, using the lastpage package and \pageref*{LastPage} works. However, as soon as multiple letters are included in the document the value of LastPage is equal to the number of pages in the last letter. So, if, for example I have two letters in my document, one with 2 pages followed by on of 4 pages, the "Y" above is set to 4 also in the first letter.
My first idea was to define the footers (by setting \firstfoot and \nextfoot in \AtEndLetter{} because at that time I can use \thepage. Unfortunately (and, in retrospect obviously), in that case only the last page in each letter gets the correct footer (the ones before get the default scrlttr2 footers).
By the way, this is not a duplicate of How can I add "page # of ##" on my document?, I have read the answers there, but (understandably) none seem to deal with the fact that there can be more than one last page in a document.


\pagemark. Great to hear that there will be a command for this in the upcoming release. – ph0t0nix Jul 15 '15 at 14:20