How to test emails with mailtrap (automatically)?

I want to assert that the right email with the right information is sent after registration. How do I do it in my auto-test?

I use the Nightwatch framework and js. I’ve seen that the mailtrap tool can be used for this purpose, but all the resources that I could find lacked good documentation or were focused on it from developer’s point of view.

Can someone please provide some good resources where it’s described how to configure and test emails via code (I don’t need to send them via code, they are sent during my auto-tests, I just need to have a way to get them and assert that they have the right information).