  In this paper, an iterative algorithm is presented for solving Sylvester
tensor equation
$\mathscr{A}*_M\mathscr{X}+\mathscr{X}*_N\mathscr{C}=\mathscr{D}$, where
$\mathscr{A}$, $\mathscr{C}$ and $\mathscr{D}$ are given tensors with
appropriate sizes, and the symbol $*_N$ denotes the Einstein product. By this
algorithm, the solvability of this tensor equation can be determined
automatically, and the solution of which (when it is solvable) can be derived
within finite iteration steps for any initial iteration tensors in the absence
of roundoff errors. Particularly, the least F-norm solution of the
aforementioned equation can be derived by choosing special initial iteration
tensors. As application, we apply the proposed algorithm to the tensor nearness
problem related to the Sylvester tensor equation mentioned above. It is proved
that the solution to this problem can also be obtained within finite iteration
steps by solving another Sylvester tensor equation. The performed numerical
experiments show that the algorithm we propose here is promising.
