Unit testing [XCTest]

Hello world, I'm doing unit testing with Swift. I need to create a test for the registration process of an application. When I register, a confirmation link is sent to the specified email. How can I create a test that allows me to access the email and click on the link to confirm the registration?