There is a necessary and sufficient condition. It is called regularity. There is a simple criterion due to Wiener which tells you when a boundary point $x_0$ is regular, for $n\geq 3$ it says
$$\sum\frac{C(E_m)}{q^{m(n-2)}}=\infty,$$ where $$ E_m=E\cap\{ x:|x-x_0|\in[q^{m+1},q^m)\},$$ where $E$ is the boundary of the domain, $q\in(0,1)$, and $C$ is the Newton capacity. This has to be modified when $n=2$: $$\sum\frac{m}{\log(2/c(E_m))}=\infty,$$ where $c(E)$ is the logarithmic capacity.
Regularity means that all boundary points are regular.
In the plane, there is also a simple sufficient condition (usually easier to verify than the general Wiener criterion): a point $z$ is regular if it belongs to a continuum $K$ which is a subset of the boundary. This implies that the Dirichlet problem is always solvable for a simply connected bounded region in the plane.
Remark: a continuum is a compact connected set containing at least 2 points. (All such sets in $\Bbb R^n$ have the same power, which is called the "power of continuum". The simplest example of discontinuum of the power of continuum is a Cantor set).
References
Naum S. Landkof, Foundations of modern potential theory. Berlin-Heidelberg-New York: Springer-Verlag, pp. X+424 (1972), MR0350027, Zbl 0253.31001. Wikipedia lists few other books.
For $n=2$, the standard reference is
Thomas Ransford, Potential theory in the complex plane, Cambridge: Cambridge University Press, pp. x+232 (1995), MR1334766, Zbl 0828.31001.