Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martenframework/marten-mailgun-emailing
A Mailgun emailing backend for the Marten web framework.
https://github.com/martenframework/marten-mailgun-emailing
crystal email emailing framework mailgun marten web
Last synced: 2 months ago
JSON representation
A Mailgun emailing backend for the Marten web framework.
- Host: GitHub
- URL: https://github.com/martenframework/marten-mailgun-emailing
- Owner: martenframework
- License: mit
- Created: 2022-12-18T00:26:25.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-11T21:30:57.000Z (7 months ago)
- Last Synced: 2024-07-12T00:15:01.335Z (7 months ago)
- Topics: crystal, email, emailing, framework, mailgun, marten, web
- Language: Crystal
- Homepage:
- Size: 34.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Marten Mailgun Emailing
[![CI](https://github.com/martenframework/marten-mailgun-emailing/workflows/Specs/badge.svg)](https://github.com/martenframework/marten-mailgun-emailing/actions)
[![CI](https://github.com/martenframework/marten-mailgun-emailing/workflows/QA/badge.svg)](https://github.com/martenframework/marten-mailgun-emailing/actions)**Marten Mailgun Emailing** provides a [Mailgun](https://www.mailgun.com/) backend that can be used with Marten web framework's [emailing system](https://martenframework.com/docs/emailing).
## Installation
Simply add the following entry to your project's `shard.yml`:
```yaml
dependencies:
marten_mailgun_emailing:
github: martenframework/marten-mailgun-emailing
```And run `shards install` afterward.
## Configuration
First, add the following requirement to your project's `src/project.cr` file:
```crystal
require "marten_mailgun_emailing"
```Then you can configure your project to use the Mailgun backend by setting the corresponding configuration option as follows:
```crystal
Marten.configure do |config|
config.emailing.backend = MartenMailgunEmailing::Backend.new(
api_key: ENV.fetch("MAILGUN_API_KEY"),
sender_domain: ENV.fetch("MAILGUN_SENDER_DOMAIN")
)
end
```The `MartenMailgunEmailing::Backend` class needs to be initialized using a [Mailgun API key](https://documentation.mailgun.com/en/latest/api-intro.html#authentication-1) and a [Mailgun sender domain](https://documentation.mailgun.com/en/latest/user_manual.html#verifying-your-domain-1). You should ensure that these values are kept secret and that they are not hardcoded in your config files.
If needed, it should be noted that you can also change the Mailgun API endpoint URL (whose default value is **https://api.mailgun.net**). To do so, you can use set the `api_endpoint` argument accordingly when initializing your backend object:
```crystal
Marten.configure do |config|
config.emailing.backend = MartenMailgunEmailing::Backend.new(
api_key: ENV.fetch("MAILGUN_API_KEY"),
sender_domain: ENV.fetch("MAILGUN_SENDER_DOMAIN"),
api_endpoint: "https://api.eu.mailgun.net"
)
end
```## Authors
Morgan Aubert ([@ellmetha](https://github.com/ellmetha)) and
[contributors](https://github.com/martenframework/marten-mailgun-emailing/contributors).## License
MIT. See ``LICENSE`` for more details.