I was thinking if it is possible to have $g\ne e$ such that $\phi(g)=e$ for a group homomorphism $\phi: G\mapsto H$
It's not always true because $\phi(2)=0$ when $G=\Bbb Z_4$ and $H=\Bbb Z_2$
So what if $|H|\not\mid|G|$?
We have that $o(\phi(g))$ divides $o(g)$ and $|H|$ because $\phi(\langle g\rangle)$ is a subgroup of $H$
If we had $(|H|,\phi(\langle g\rangle))=1$ then we would have $o(\phi(g))=1$ and so $\phi(g)=e$
What other necessary/sufficient constraints are there for the existance of $g\in G\backslash\{e\}$ with $\phi(g)=e$?
First of all, let's use a fact to make your question a bit neater.
With this in mind, I believe that you are asking this: under what conditions does there exist an injective homomorphism from $G$ to $H$? The answer to this question is that such a homomorphism will exist if and only if $H$ contains a subgroup isomorphic to $G$. For the example of $G = \Bbb Z_2$ and $H = \Bbb Z_4$, we see that the map $\phi([n]_2) = [2n]_4$ is injective, and $\Bbb Z_4$ contains the subgroup $\{[0]_4,[2]_4\}$ which is isomorphic to $\Bbb Z_2$.
One way to prove this is to use the first isomorphism theorem. In particular, we know that for any homomorphism, $\phi(G) \cong G/\ker\phi$. However, if $\ker \phi = \{e\}$, then we have $G/\ker \phi \cong G$. So, if $\phi$ is an injective homomorphism, then $\phi(G) \cong G$, and $\phi(G)$ (the image of $\phi$) is a subgroup of $H$.
Conversely, suppose that $H$ has a subgroup $K \subset H$ and that $K \cong G$. Then, an isomorphism $\phi:G \to K$ means that we have the injective homomorphism $i_K \circ \phi:G \to H$, where $i_K:K \to H$ is the inclusion map.