Ok there, I finally figured out the problem. It turns out that the is_email() function built into WordPress is extremely slow and takes around 6 seconds to compute. Since Buddypress used the function quite leisurely, the amount of time it took to send emails ended up being quite long.
Unfortunately a simple filter wasn’t enough, as WordPress was still processing the old function. I have removed the function and the problem is therefore “fixed”. Actually “applying a bandaid” is the more appropriate term here.
I’m going to report a bug to WordPress asap now. Thanks for your attempts at helping me though! However, if you do have an idea why the function is so slow I would be very glad to hear it!
Unfortunately that can’t be it, since it is also this slow if I set wordpress to use phpmail instead. I have already tried TLS over SSL and different ports too.
Also, the WP-Mail-SMTP plugin has a function to send out test emails and those are sent instantly.
I really hope we can find the error to this. Thanks for your answers though.
Thanks for the answer and I’m glad I’m not alone with the problem.
Those snippets unfortunately didn’t help, it still took around 30 seconds for the system to send a message.