  Evaluating the action of a matrix function on a vector, that is $x=f(\mathcal
M)v$, is an ubiquitous task in applications. When $\mathcal M$ is large, one
usually relies on Krylov projection methods. In this paper, we provide
effective choices for the poles of the rational Krylov method for approximating
$x$ when $f(z)$ is either Cauchy-Stieltjes or Laplace-Stieltjes (or, which is
equivalent, completely monotonic) and $\mathcal M$ is a positive definite
matrix. Relying on the same tools used to analyze the generic situation, we
then focus on the case $\mathcal M=I \otimes A - B^T \otimes I$, and $v$
obtained vectorizing a low-rank matrix; this finds application, for instance,
in solving fractional diffusion equation on two-dimensional tensor grids. We
see how to leverage tensorized Krylov subspaces to exploit the Kronecker
structure and we introduce an error analysis for the numerical approximation of
$x$. Pole selection strategies with explicit convergence bounds are given also
in this case.
