You can use Mailgun SMTP endpoint.
Just create an SMTP user+password from your domain settings in the Mailgun dashboard and configure Flarum for smtp with these ?
I don't think it's possible to use the mailgun API like in Laravel for the moment. We would need an extension to enable that.