Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SparkPost/elixir-sparkpost
SparkPost client library for Elixir https://developers.sparkpost.com
https://github.com/SparkPost/elixir-sparkpost
elixir email sparkpost
Last synced: 2 months ago
JSON representation
SparkPost client library for Elixir https://developers.sparkpost.com
- Host: GitHub
- URL: https://github.com/SparkPost/elixir-sparkpost
- Owner: SparkPost
- License: apache-2.0
- Created: 2015-12-03T17:07:30.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-30T08:52:49.000Z (about 2 years ago)
- Last Synced: 2024-10-01T13:39:12.215Z (3 months ago)
- Topics: elixir, email, sparkpost
- Language: Elixir
- Size: 91.8 KB
- Stars: 44
- Watchers: 25
- Forks: 14
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - An Elixir library for sending email using SparkPost. (Third Party APIs)
- fucking-awesome-elixir - sparkpost - An Elixir library for sending email using SparkPost. (Third Party APIs)
- awesome-elixir - sparkpost - An Elixir library for sending email using SparkPost. (Third Party APIs)
README
[Sign up](https://app.sparkpost.com/join?plan=free-0817?src=Social%20Media&sfdcid=70160000000pqBb&pc=GitHubSignUp&utm_source=github&utm_medium=social-media&utm_campaign=github&utm_content=sign-up) for a SparkPost account and visit our [Developer Hub](https://developers.sparkpost.com) for even more content.
# SparkPost Elixir Library
[![Travis CI](https://travis-ci.org/SparkPost/elixir-sparkpost.svg?branch=master)](https://travis-ci.org/SparkPost/elixir-sparkpost) [![Coverage Status](https://coveralls.io/repos/SparkPost/elixir-sparkpost/badge.svg?branch=master&service=github)](https://coveralls.io/github/SparkPost/elixir-sparkpost?branch=master)
The official [Elixir](http://elixir-lang.org/) package for the [SparkPost API](https://www.sparkpost.com/api).
Capabilities include:
- convenience functions for easy "I just want to send mail" users
- advanced functions for unleashing all of Sparkpost's capabilities## Installation
1. Add sparkpost and ibrowse to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:sparkpost, "~> 0.5.1"}
]
end
```2. Ensure sparkpost is started before your application:
```elixir
def application do
[applications: [:sparkpost]]
end
```3. Update your dependencies:
```bash
$ mix deps.get
```## Usage
### Configuration
In your config/config.exs file:
```elixir
config :sparkpost, api_key: "YOUR-API-KEY"
```### Option 1: Convenience
```elixir
defmodule MyApp.Example do
def send_message do
SparkPost.send to: "[email protected]",
from: "[email protected]",
subject: "Sending email from Elixir is awesome!",
text: "Hi there!",
html: "Hi there!
"
end
end
```### Option 2: Full SparkPost API
```elixir
defmodule MyApp.Example do
alias SparkPost.{Content, Recipient, Transmission}
def send_message do
Transmission.send(%Transmission{
recipients: [ "[email protected]" ],
content: %Content.Inline{
subject: "Sending email from Elixir is awesome!",
from: "[email protected]",
text: "Hi there!",
html: "Hi there!
"
}
})
end
end
```Start your app and send a message:
```bash
$ iex -S mix
iex> MyApp.Example.send_message
{:ok, ...}
```### Contribute
We welcome your contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to help out.
### Change Log
[See ChangeLog here](CHANGELOG.md)