Swiftpack.co - aronbudinszky/postmark-swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by aronbudinszky.
aronbudinszky/postmark-swift v0.2.0
A Swift package that connects to the Postmark API to reliably send emails.
⭐️ 1
🕓 1 year ago
iOS macOS
.package(url: "https://github.com/aronbudinszky/postmark-swift.git", from: "v0.2.0")

PostmarkSwift

A Swift package that connects to the Postmark API to reliably send emails.

WARNING! This package is work in progress

Although a basic email can be sent at this point, a lot of functionality is still being developed. APIs might change.

Supported platforms Swift versions

Add the package

Only SwiftPM is supported at this time.

To add the package, simply select File / Add Packages... in Xcode and paste this URL into the search / url box: https://github.com/aronbudinszky/postmark-swift .

Send your first message

Since PostmarkSwift uses the new async/await API, it will require at least iOS 13 or macOS 12.

// Create client and send
let client = PostmarkSwift.Client(serverToken: "your-server-token")
        
// Create an email message
let message = PostmarkSwift.OutgoingEmail(
    from: "[email protected]",
    to: "[email protected]",
    subject: "Hello",
    textBody: "World!"
)
        
// Send it and report the results
let result = try await client.send(message)
print("Message was submitted for sending at \(result.submittedAt) to recipient(s) \(result.to) with ID \(result.messageID)")

If there are any problems with your request the appropriate error will be thrown when you try to send.

Send an HTML message

You can also send HTML messages, like so:

// Create an email message
let message = PostmarkSwift.OutgoingEmail(
    from: "[email protected]",
    to: "[email protected]",
    subject: "Hello",
    textBody: "World!",
    htmlBody: "<strong>World!</strong>"
)

GitHub

link
Stars: 1
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics