EnqueueMail
This library provides enqueueing mail to MailQueue in Elixir.
Installation
The package can be installed by adding enqueue_mail to your list of dependencies in mix.exs:
def deps do
[
{:enqueue_mail, "~> 0.1.0"}
]
endConfiguration
Tha server has to be pointed with MailQueue. The rest of settings have to be the same with MailQueue.
config :enqueue_mail, EnqueueMail,
amqp_server: "amqp://app:app@localhost",
exchange: "gen_server_mail_exchange",
queue: "gen_server_mail_queue",
queue_error: "gen_server_mail_queue_error"Data Format:
message Email {
string from = 1;
string to = 2;
string subject = 3;
string text_body = 4;
string html_body = 5;
}Usage
def enqueue_mail(from, to, subject, text_body, html_body) do
Email.new(
from: from,
to: to,
subject: subject,
text_body: text_body,
html_body: html_body)
|> Email.encode()
|> EnqueueMail.send_mail()
endeex can be used for text_body and/or html_body.
for exapmple:
html_body = EEx.eval_file(< eex template file >, [from: from, email: email, title: title, content: content])
endReferences:
- MailQueue
- Protocol Buffers Official
- clojusc/protobuf (Elixir Protocol Buffer library)
- pma/amqp (Elixir AMQP client)
Licence:
[MIT]