Just wanted to post a fix that worked for me 🙂
In my case, I was using AWS for my email. AWS lets you use port 25, 587 or 2587. With port 25, I was getting this error:
flarum.ERROR: Swift_TransportException: Connection could not be established with host email-smtp.ap-southeast-2.amazonaws.com :stream_socket_client(): unable to connect to tcp://...............amazonaws.com:25 (Connection timed out) in /........./vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:261
Switching to port 587 fixed everything! Apparently my hosting provider was blocking low ports, which I guess kind of makes sense! 🙂