How to send and receive email in Swift using MailSlurp email API in conjunction with Xcode. For a more generalized guide see the send emails in Swift example.

About

MailSlurp is a library with iOS/iPadOS/MacOS/TVOS support via swift and objective C for sending an receiving emails from real email addresses in code an tests. Use MailSlurp to test iOS apps end-to-end using test email accounts or embed MailSlurp to send and receive emails from apps.

Install MailSlurp in XCode

To get started using MailSlurp first create a new XCode project

Alternative Package.swift installation

You can also use Package.swift and Swift Package Manager to install MailSlurp:

Run to install dependencies.

Using MailSlurp in Swift code

The MailSlurp library creates controllers for every endpoint on the MailSlurp REST API