Either epoxies or super glues, used correctly bond well to metals.
You can also get posts with a wide pad intended for use with the 3M
adhesive foam products. Used correctly, these provide a very good
bond, since the resilience of the foam layer helps prevent the posts
being torn off easily.
However, if the earrings are actually metal, you’ll get probably a
significantly better and more permanent bond if you use a solder or
weld. Few repairs done with just glue are all that good over time.
If the metal is low melting or otherwise cannot allow higher
temperatures, then consider a low melting solder like TIX. Melts
under 300F, and though not the equal of silver or gold solders, is
still usually a lot better for both strength and looks, than any
glues would be. If possible, a gold or silver solder, perhaps one of
the lower karat, lower melting, repair grades, could be used with
again, a considerable increase in the quality of the repair.
Also, considering the current technologies available, thinks like
Sparkie fusion welders, and laser welders, either of which can easily
put new earposts on metal earrings of many types, not just precious
metals, I’d be reluctant to advise you to use a glue or adhesive
unless you’ve no other real choice. If you don’t have these methods
available to you, you’d be well advised to find someone who does.
The probably low cost of having this done right might well be worth
it for the quality of work you’ll get as a result.