Skip to content

Commit

Permalink
review docs
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Jan 14, 2024
1 parent c435ed3 commit ff25787
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,14 @@
# haraka-plugin-resque
Haraka plugin that act as a queue and perform REST post to a remote url.


# Ideal Setup
You're a SASS Provider (such as form submission like Wufoo) requiring to send email on-behalf-of client.

### Configuration

If the default configuration is not sufficient, copy the config file from the distribution into your haraka config dir and then modify it:

```sh
cp node_modules/haraka-plugin-resque/config/resque.json config/resque.json
$EDITOR config/resque.json
```

## USAGE

SMTP-Client -> Haraka -> API -> Working-SMTP Server - using a different email sends on-behalf-of/sends-as client.
SMTP-Client -> Haraka -> API -> Working-SMTP Server - using a different email `sends on-behalf-of/sends-as` your Client.

This plugin pushes your email to a REST API.

Expand All @@ -31,23 +24,35 @@ sed -i -e 's,^queue/smtp_forward,#queue/smtp_forward,' config/plugins
# this enable resque, if it's not already in config/plugins folder
grep -qxF 'resque' config/plugins || echo "resque" >> config/plugins

```

Next, copy and edit the default configuration.

```sh
cp node_modules/haraka-plugin-resque/config/resque.json config/resque.json
$EDITOR config/resque.json

# now restart haraka
service haraka restart

```

## But what is this Sends On-Behalf-Of?
https://stackoverflow.com/questions/2782380/best-practices-sending-email-on-behalf-of-users

## And what is this sends on-behalf-of?
The best method is to set the `Reply-To` header and play around with the `From Name`. For example, if we set the `From Name` as `[email protected] (original/client's from email) <-`, then Outlook 365 would look like so `[email protected] <- <[email protected]>`

Then when user hit reply, it will go to/autofill with `[email protected]`; which, if you look at from field, it look exactly like how it work `[email protected] <- <[email protected]>`

Ref: https://stackoverflow.com/questions/2782380/best-practices-sending-email-on-behalf-of-users


## To run/debug locally
```sh
# run locally with
docker-compose up
```

Then to test locally, simply open a new terminal and exec:
To test locally, simply open a new terminal and exec:
```sh
# swaks can be install with homebrew on your macos
# type: PLAIN,LOGIN,CRAM-MD5
Expand All @@ -58,14 +63,25 @@ swaks -f [email protected] -t [email protected] \
--auth-user "usertest1" --auth-password "testes123"
```

NOTE: it is recommended that you enable tls. See Haraka documentation here: https://haraka.github.io/plugins/tls
Now you can view/edit the files in `data/config` and `config/resque` to manipulate your running container configurations. If you want a completely fresh start/restart, the `cleanup.sh` script be of help.

```sh
# to reset/restart, simply take down the existing docker containers
docker-compose down
# run to cleanup data folder files
./cleanup.sh
# start a new set of containers
docker-compose up
```

NOTE: It is recommended that you enable tls. See Haraka documentation here: https://haraka.github.io/plugins/tls

Since we allow sending with any `FROM` address, `resque` requires authentication. Therefore, we must configure `resque.json` with user credentials in order to authenticate. Then we also need to do the following configuration for Hakara to work:
Since we allow sending with any `FROM` address, `resque` requires authentication. Therefore, we must configure `resque.json` with user credentials. We also need the following configurations for Hakara to work:

1. Enable tls in config/plugins - which is handle inside of our `mystart.sh`
2. Enable tls by adding tls.ini - which is included in folder `defaults/config/tls.ini`
3. Set your server `HOSTNAME` inside of docker-compose for using OpenSSL generated self-sign cert.
4. Test it with `-tls` with swaks. If you have SSL issue with certain email client (such as Wordpress SMTP plugin), then you might have to purchase an actual certificate and replace the two files `tls_cert.pem` and `tls_key.pem` inside of config folder.
1. Enable `tls` in `config/plugins` - which is handled inside of `data/mystart.sh`
2. Because we enable tls, we'll need `tls.ini` - which is included in `defaults/config/tls.ini`
3. Set your server `HOSTNAME` inside of docker-compose for using OpenSSL generated self-signed cert.
4. Test it with `-tls` with `swaks` to confirm that `STARTTLS` is working. If you have SSL issue with certain email client (such as Wordpress SMTP plugin), then you might have to purchase an actual certificate with `tls_cert.pem` and `tls_key.pem` inside of `data/config` folder.

## Planning / Todo
- [x] Json configuration
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haraka-plugin-resque",
"version": "1.1.5",
"version": "1.1.6",
"description": "Haraka plugin that act as a queue and perform REST post to a remote url",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit ff25787

Please sign in to comment.