vapor-resend

1.0.3

Swift Vapor SDK for Resend email service
hsharghi/vapor-resend

What's New

v1.0.3

2024-06-14T08:05:25Z

Update README and tags

VaporResend

Vapor Logo Swift 5.10 Logo MIT License

VaporResend is a wrapper for the SwiftResend package, designed for use with the Vapor framework to communicate with the Resend email sending platform API.

Setup

Add Dependency

Add the dependency to your Package.swift:

dependencies: [
	...
	.package(url: "https://github.com/hsharghi/vapor-resend.git", from: "1.0.0")
],
targets: [
    .target(name: "App", dependencies: [
        .product(name: "VaporResend", package: "vapor-resend"),
    ]),

Configure Environment Variable

Provide the RESEND_API_KEY environment variable for authentication.

Usage

Sending Emails

Import VaporResend modules and configure your routes:

import Vapor
import VaporResend

func routes(_ app: Application) throws {
    app.get("send") { req async throws -> String in
        let id = try await req.resend.emails.send(email: .init(from: .init(email: "hadi@domain.com", name: "Hadi"),
                                            to: [.init(email: "john@apple.com")],
                                            subject: "Sending email from Vapor",
                                           text: "Email sent using ResendVapor"))
        
        return id
    }
}

For full SDK documentation check out SwiftResend Package.

Description

  • Swift Tools 5.10.0
View More Packages from this Author

Dependencies

Last updated: Fri Oct 18 2024 13:01:01 GMT-0900 (Hawaii-Aleutian Daylight Time)