Enviar rexistro por email: Optimality of a time-dependent treatment profile during an epidemic