Skip to content

Commit

Permalink
Merge pull request #49 from gotthardp/gh-48
Browse files Browse the repository at this point in the history
Pin gen-smtp/gen_smtp dep to 1.1.1
  • Loading branch information
lukebakken authored Mar 8, 2022
2 parents e818b0a + 5e186aa commit 4cb0e8b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ on:
jobs:
CI:
name: Build and test on Erlang/OTP ${{ matrix.otp-version }}
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
otp-version: [23, 24]
env:
LATEST_OTP_RELEASE: 24
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp-version}}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DEP_RANCH_VERSION = 2.1.0

dep_ranch = ranch $(DEP_RANCH_VERSION)
dep_eiconv = hex 1.0.0
dep_gen_smtp = git https://github.com/gen-smtp/gen_smtp.git master
dep_gen_smtp = git https://github.com/gen-smtp/gen_smtp.git 1.1.1

DEPS = gen_smtp rabbit_common amqp_client rabbit eiconv

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ contributions are encouraged.

## Installation

Due to the dependency on the `eiconv` library, which has a C source code component, this plugin must be compiled from source. If you are planning to use RabbitMQ version 3.9.10:
Due to the dependency on the `eiconv` library, which has a C source code component, this plugin must be compiled from source. If you are planning to use RabbitMQ version 3.9.13:

```
git clone https://github.com/gotthardp/rabbitmq-email.git
cd rabbitmq-email
make RABBITMQ_VERSION=v3.9.10
make
make tests # optional
make dist
make RABBITMQ_VERSION=v3.9.13 dist
```

Copy the following directories to your RabbitMQ `plugins/` directory:

```
plugins/eiconv-1.0.0
plugins/gen_smtp-1.1.1
plugins/rabbitmq_email-1.0.0
plugins/rabbitmq_email-1.0.1
```

Note that as of version 1.0.0 this plugin has been tested with RabbitMQ v3.9.x versions only.
Note that as of version 1.0.1 this plugin has been tested with RabbitMQ v3.9.x versions only.

## Documentation

Expand Down
10 changes: 8 additions & 2 deletions src/rabbit_email_sender.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ send_email(To, Domain, {Type, Subtype}, Headers, Payload) ->
[{<<"From">>, construct_address(From, Domain)},
{<<"To">>, ToAddr}],

Message = mimemail:encode({Type, Subtype,
lists:foldr(fun set_header/2, [], Headers2), [], Payload}),
Headers3 = lists:foldr(fun set_header/2, [], Headers2),
% Note FUTURE for gen_smtp 1.2.0:
% mimemail:encode argument:
% {Type, Subtype, Headers, ContentTypeParams, Parts}
% https://github.com/gen-smtp/gen_smtp/pull/190
% https://github.com/gen-smtp/gen_smtp/blob/1.1.1/src/mimemail.erl#L82-L89
% https://github.com/gen-smtp/gen_smtp/blob/c6f25a758d60da9788bf5ddf73e985dacb28f74b/src/mimemail.erl#L98-L108
Message = mimemail:encode({Type, Subtype, Headers3, [], Payload}),

% client_sender must be a valid user, whereas From doesn't have to
{ok, Sender} = application:get_env(rabbitmq_email, client_sender),
Expand Down
2 changes: 1 addition & 1 deletion src/rabbitmq_email.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{application, rabbitmq_email,
[{description, " E-mail gateway for AMQP 0-9-1"},
{vsn, "1.0.0"},
{vsn, "1.0.1"},
{modules, []},
{registered, []},
{mod, {rabbitmq_email_app, []}},
Expand Down

0 comments on commit 4cb0e8b

Please sign in to comment.