How email system work?

Hello all.

I want to change behavior of my forum.
Dont ask why, but i want forum to send emails data to Rabbitmq queue instead of sending them using ordinary email services…
Can you please tell me, where is the line in code which is responsible for email sending?
I would be very thankful.