npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

haraka-plugin-resque

v1.1.7

Published

Haraka plugin that act as a queue and perform REST post to a remote url

Downloads

28

Readme

NPM

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.

USAGE

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.

cd /path/to/local/haraka
npm install haraka-plugin-resque

# you should disable the default/dummy smtp_forward plugin
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.

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

# now restart haraka
service haraka restart

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

# run locally with
docker-compose up

To test locally, simply open a new terminal and exec:

# swaks can be install with homebrew on your macos
# type: PLAIN,LOGIN,CRAM-MD5
# note: -tls is important here if you want to test with authenticate
# https://github.com/haraka/Haraka/issues/2760#issuecomment-597248728
swaks -f [email protected] -t [email protected] \
	--server localhost -tls --port 25 --auth LOGIN \
	--auth-user "usertest1" --auth-password "testes123"

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.

# 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. We also need the following configurations for Hakara to work:

  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.

Note

  1. To use self-signed cert with WP Mail SMTP plugin, make sure you disable verification with custom code:
<?php
add_filter('wp_mail_smtp_custom_options', function( $phpmailer ) {
	$phpmailer->SMTPOptions = array(
		'ssl' => array(
			'verify_peer'       => false,
			'verify_peer_name'  => false,
			'allow_self_signed' => true
		)
	);

	return $phpmailer;
} );

Planning / Todo

  • [x] Json configuration
  • [x] Support login credential
  • [x] Support API URL switching based on credentials
  • [ ] Convert to Typescript and Jest for testing
  • [ ] More unit testing cases