All Projects → vapor-community → sendgrid

vapor-community / sendgrid

Licence: MIT license
SendGrid-powered mail backend for Vapor

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to sendgrid

wkhtmltopdf
Generate and return PDFs from Vapor views
Stars: ✭ 53 (-19.7%)
Mutual labels:  vapor, vapor-provider
mysql-provider
MySQL provider for the Vapor web framework.
Stars: ✭ 31 (-53.03%)
Mutual labels:  vapor, vapor-provider
fluent-mysql-driver
🖋🐬 Swift ORM (queries, models, relations, etc) built on MySQL.
Stars: ✭ 69 (+4.55%)
Mutual labels:  vapor, vapor-service
fluent-provider
A provider for including Fluent in Vapor applications
Stars: ✭ 13 (-80.3%)
Mutual labels:  vapor, vapor-provider
postgres-kit
🐘 Non-blocking, event-driven Swift client for PostgreSQL.
Stars: ✭ 125 (+89.39%)
Mutual labels:  vapor, vapor-service
Lingo-Vapor
Vapor provider for Lingo - the Swift localization library
Stars: ✭ 45 (-31.82%)
Mutual labels:  vapor, vapor-provider
fluent-postgres-driver
🐘 PostgreSQL driver for Fluent.
Stars: ✭ 120 (+81.82%)
Mutual labels:  vapor, vapor-service
VaporGCM
A simple Android GCM/FCM library for Swift/Vapor
Stars: ✭ 25 (-62.12%)
Mutual labels:  vapor, vapor-provider
leaf-markdown
Markdown renderer for Vapor
Stars: ✭ 51 (-22.73%)
Mutual labels:  vapor, vapor-provider
auth
👤 Authentication and Authorization framework for Fluent.
Stars: ✭ 51 (-22.73%)
Mutual labels:  vapor, vapor-service
Mailcore
Emailing wrapper for Vapor 3 apps
Stars: ✭ 77 (+16.67%)
Mutual labels:  vapor, sendgrid
apns
Vapor APNS for iOS
Stars: ✭ 59 (-10.61%)
Mutual labels:  vapor, vapor-service
KarmaAPI
Swift API using the Vapor web framework and Turnstile for authentication
Stars: ✭ 20 (-69.7%)
Mutual labels:  vapor
mesan-nodejs-auth-crud-api
NodeJS Authentication and CRUD operations API -: Email Verification, Image Upload, Password Reset
Stars: ✭ 72 (+9.09%)
Mutual labels:  sendgrid
mailer
Simple Email Sending Client for Mailgun & Sendgrid services in crystal
Stars: ✭ 16 (-75.76%)
Mutual labels:  sendgrid
VaporTwilioService
Twilio API provider for all your Vapor needs
Stars: ✭ 19 (-71.21%)
Mutual labels:  vapor
flask-sendgrid
Flask plugin to simplify sending emails through SendGrid.
Stars: ✭ 23 (-65.15%)
Mutual labels:  sendgrid
MailHookBundle
A bundle to catch API webhook from different mail service
Stars: ✭ 36 (-45.45%)
Mutual labels:  sendgrid
web-template
A starting point for web applications
Stars: ✭ 42 (-36.36%)
Mutual labels:  vapor
VaporCRUDRouter
A Rails-inspired extension to Vapor's routing system
Stars: ✭ 58 (-12.12%)
Mutual labels:  vapor

SendGrid Provider for Vapor

Continuous Integration Swift 5.2

Adds a mail backend for SendGrid to the Vapor web framework. Send simple emails, or leverage the full capabilities of SendGrid's V3 API.

Setup

Add the dependency to Package.swift:

.package(url: "https://github.com/vapor-community/sendgrid.git", from: "4.0.0")

Make sure SENDGRID_API_KEY is set in your environment. This can be set in the Xcode scheme, or specified in your docker-compose.yml, or even provided as part of a swift run command.

Optionally, explicitly initialize the provider (this is strongly recommended, as otherwise a missing API key will cause a fatal error some time later in your application):

app.sendgrid.initialize()

Now you can access the client at any time:

app.sendgrid.client

Using the API

You can use all of the available parameters here to build your SendGridEmail Usage in a route closure would be as followed:

import SendGrid

let email = SendGridEmail()

return req.application.sendgrid.client.send([email], on: req.eventLoop)

Error handling

If the request to the API failed for any reason a SendGridError is the result of the future, and has an errors property that contains an array of errors returned by the API:

return req.application.sendgrid.client.send([email], on: req.eventLoop).flatMapError { error in
    if let sendgridError = error as? SendGridError {
        req.logger.error("\(error)")
    }
    // ...
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].