The example for sending using the API doesn't work as-is. Specifically:
defmodule MyApp.Example do
alias SparkPost.Transmission
alias SparkPost.Recipient
alias SparkPost.Template
def send_message do
Transmission.create(%Transmission{
recipients: [ %Recipient{ address: %Sparkpost.Address{ email: "your@example.com" }} ],
return_path: "elixir@sparkpostbox.com",
content: %Template.Inline{
subject: "Sending email from Elixir is awesome!",
from: %Sparkpost.Address{ email: "elixir@sparkpostbox.com" },
text: "Hi there!",
html: "<p>Hi there!</p>"
}
})
end
end
References to Sparkpost.Address should be SparkPost.Address
Cannot find SparkPost.Template
We should also use the new Elixir 1.2 syntax for aliases to change this:
alias SparkPost.Transmission
alias SparkPost.Recipient
alias SparkPost.Template
To this:
alias SparkPost.{Transmission, Recipient, Template}
A few other things:
I think we should abstract the recipients and addresses away from the user - ideally we could just pass an array to recipients like this: recipients: ["email@somewhere.com", "Friendly Person <friend@somewhere.com"] and just handle the splitting/converting to structs for the user
The example for sending using the API doesn't work as-is. Specifically:
Sparkpost.Address
should beSparkPost.Address
SparkPost.Template
We should also use the new Elixir 1.2 syntax for aliases to change this:
To this:
A few other things:
recipients: ["email@somewhere.com", "Friendly Person <friend@somewhere.com"]
and just handle the splitting/converting to structs for the userdefmodule
s in the files