Home

Awesome

nodemailer-base64-to-s3

build status code style styled with prettier made with lass license

Convert your base64 encoded data URI's in <img> tags to Amazon S3/CloudFront URL's

<img src="https://cdn.rawgit.com/forwardemail/nodemailer-base64-to-s3/master/media/screenshot.png" width="361.5" height="80.75" />

It's the perfect alternative to cid-based embedded images!

Table of Contents

Features

Tip: This package is bundled with Lad and already pre-configured for you.

Install

npm:

npm install nodemailer-base64-to-s3

Usage

const base64ToS3 = require('nodemailer-base64-to-s3');
const nodemailer = require('nodemailer');

const transport = nodemailer.createTransport({
  // pass some options here to create a transport
  // this example simply shows a JSONTransport type
  // <https://nodemailer.com/transports/>
  jsonTransport: true
});
transport.use('compile', base64ToS3(options));

Options

Accepts the following arguments and returns a Nodemailer plugin.

Gmail Example

This is a screenshot taken directly from Gmail on a Retina-supported device.

<img src="https://cdn.rawgit.com/ladjs/nodemailer-base64-to-s3/master/media/gmail-screenshot.png" width="808" height="916" />

Above we have a Lad sample email sent using Nodemailer and Nunjucks.

What does it look like behind the scenes?

Here's a snippet from the navbar shown in the screenshot above. We utilize font-awesome-assets for rendering the icons/images and code block.

<div class="container header p-y-1">
  <nav>
    <ul class="nav nav-pills pull-xs-right">
      <li class="nav-item"><a title="Book" class="btn btn-md btn-outline-secondary" href="{{ config.urls.web }}/{{ locale }}">{{ fa.png2x('book', '#ccc', 20, 20, [ [ 'class', 'fa-img' ] ]) | safe }}<span class="hidden-sm-down"> {{ t('Book') }}</span></a></li>
      <li class="nav-item"><a title="Jobs" class="btn btn-md btn-outline-secondary" href="{{ config.urls.web }}/{{ locale }}/jobs">{{ fa.png2x('briefcase', '#ccc', 20, 20, [ [ 'class', 'fa-img' ] ]) | safe }}<span class="hidden-sm-down"> {{ t('Jobs') }}</a></a></li>
      <li class="nav-item"><a title="GitHub" class="btn btn-md btn-outline-secondary" href="https://github.com/ladjs/lad">{{ fa.png2x('github', '#ccc', 20, 20, [ [ 'class', 'fa-img' ] ]) | safe }}<span class="hidden-sm-down"> GitHub</span></a></li>
    </ul>
  </nav>
  <h1 class="m-b-0 h4"><a class="text-muted" href="{{ config.urls.web }}/{{ locale }}">{{ 'crocodile' | emoji }}<span class="hidden-sm-down"> Lad</span></a></h3>
</div>

Contributors

NameWebsite
Nick Baughhttp://niftylettuce.com/

License

MIT © Nick Baugh