Gravar-mail: Theory for the optimal detection of time-varying signals in cellular sensing systems