Skip to content

hsharghi/vapor-resend

Repository files navigation

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: "[email protected]", name: "Hadi"),
                                            to: ["[email protected]"],
                                            subject: "Sending email from Vapor",
                                           text: "Email sent using ResendVapor"))
        
        return id
    }
}

For full SDK documentation check out SwiftResend Package.

License

This package is released under the MIT license. See LICENSE for details.

About

Swift Vapor SDK for Resend email service

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages