Testing mail server connection?

Does anybody know of a way to test that the configured mail server
connection works? In a similar vein, is there a way to simply test the
database connection? I use db:migrate for that now but I'd prefer a
method that simply verifies the connection settings.