https://github.com/hachreak/pushmail_backend_gen_smtp
A plugin for PushMail to send the email with gen_smtp.
https://github.com/hachreak/pushmail_backend_gen_smtp
Last synced: 5 months ago
JSON representation
A plugin for PushMail to send the email with gen_smtp.
- Host: GitHub
- URL: https://github.com/hachreak/pushmail_backend_gen_smtp
- Owner: hachreak
- License: gpl-2.0
- Created: 2016-02-11T22:07:01.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-19T21:46:26.000Z (about 9 years ago)
- Last Synced: 2025-02-16T22:27:54.617Z (8 months ago)
- Language: Erlang
- Size: 1.41 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
pushmail backend gen_smtp
=========================A plugin for PushMail to send the email with
[gen_smtp](https://github.com/Vagabond/gen_smtp).Configuration
-------------To configure for example the plugin to send emails.
```erlang
[
{pushmail, [
{backend, pushmail_backend_gen_smtp},
{backend_gen_smtp, [
{ssl, true},
{tls, if_available}, % always, never, if_available
{auth, always},
{hostname, "127.0.0.1"},
{retries, 1}, % how many retries per smtp host on temporary failure
{relay, "smtp.server.com"},
{username, "user@server.com"},
{password, "mypassword"}
]}
]}
]
```Usage
-----Start `pushmail`.
You can directly the backend configuration calling `pushmail:start/1`.
If you don't specify any argument, the backend load configuration from
`.config`.```erlang
application:ensure_all_started(pushmail).
{ok, AppCtx} = pushmail:start().
```After that, you are ready to send email with:
```erlang
Mail = #{
sender => <<"Sender ">>,
receivers => [<<"Receiver1 ">>],
subject => <<"My subject">>,
message => <<"My message!">>,
headers => {}
},
{ok, NewAppCtx} = pushmail:send(Mail, AppCtx).
```To stop the application:
```erlang
pushmail:stop(NewAppCtx).
```Build
-----$ ./utils/rebar3 compile