You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+33-22
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ Usually, building HTML emails yourself is tedious. On top of that, add the need
13
13
2.[Template paths on deployed instances](#template-paths-on-deployed-instances)
14
14
3.[Template helpers](#template-helpers)
15
15
4.[Layouts](#layouts)
16
-
5.[Previewing and sending](#previewing-and-sending)
17
-
6.[Paths](#paths)
18
-
7.[Sample file structure](#sample-file-structure)
19
-
8.[Logging](#logging)
20
-
9.[Plain-text](#plain-text)
16
+
5.[Plain text version](#plain-text)
17
+
6.[Previewing and sending](#previewing-and-sending)
18
+
7.[Paths](#paths)
19
+
8.[Sample file structure](#sample-file-structure)
20
+
9.[Logging](#logging)
21
21
6.[Version history](#version-history)
22
22
7.[Contributing](#contributing)
23
23
@@ -28,7 +28,7 @@ Usually, building HTML emails yourself is tedious. On top of that, add the need
28
28
-**SCSS support** using `node-sass` (opt-in).
29
29
-**Preview and debug** emails in development mode in your browser when developing.
30
30
-**Layouts** for re-using markup.
31
-
-**Auto Plain-text** automatically creates a plain text version from your html template for lower Spam score.
31
+
-**Auto Plain-text** automatically creates a plain text version from your HTML template for lower spam score.
32
32
33
33
Help is appreciated in order to hammer out potential issues and bugs.
34
34
@@ -82,6 +82,8 @@ Please inspect the provided sample code for details.
82
82
silent:false, // If set to `true`, any `Logger.info` calls won't be shown in the console to reduce clutter.
83
83
addRoutes:process.env.NODE_ENV==='development'// Add routes for previewing and sending emails. Defaults to `true` in development.
84
84
language:'html'// The template language to use. Defaults to 'html', but can be anything Meteor SSR supports (like Jade, for instance).
85
+
plainText:true// Send plain text version of HTML email as well.
86
+
plainTextOpts: {} // Options for `html-to-text` module. See all here: https://www.npmjs.com/package/html-to-text
85
87
}
86
88
```
87
89
@@ -93,8 +95,6 @@ Please inspect the provided sample code for details.
93
95
templates: {}, // Required. A key-value hash where the keys are the template names. See more below.
94
96
helpers: {}, // Global helpers available for all templates.
95
97
layout: false // Global layout template.
96
-
settings:
97
-
plainText: true // Optional, defaults to true
98
98
}
99
99
```
100
100
@@ -339,6 +339,23 @@ It's you to render the raw CSS in your layout:
339
339
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
340
340
```
341
341
342
+
### Plain text version
343
+
344
+
By default, plain text versions are automatically created from your html template and included in the final email. It's strongly advises to leave this option on, as it greatly reduces your emails' spam score and the chance that your emails will end up in spam folder of users. However, if you want to override this behaviour simply at this to `Mailer.config()`:
345
+
346
+
```coffeescript
347
+
Mailer.config(
348
+
# ...
349
+
plainText:false,
350
+
plainTextOpts: {
351
+
//Youroptionstosendtothemodule, defaultsto {}
352
+
ignoreImage:true
353
+
}
354
+
)
355
+
```
356
+
357
+
Consult the `html-to-text`[documentation](https://www.npmjs.com/package/html-to-text) for available options. See in the example app in this repo for how to disable images in plain text version, for instance.
358
+
342
359
### Previewing and Sending
343
360
344
361
`lookback:emails` makes it easier to preview email designs in your browser. And you can even interface with you database collections in order to fill them emails with *real data*.
@@ -349,11 +366,12 @@ Noticed the `route` property on the template? It uses Iron Router's server side
349
366
350
367
The `route` property expects a `path` property (feel free to use any of Iron Router's fanciness in here) and an optional `data` function providing the data context (an object). The function has access to the same scope as Iron Router's `action` hook, which means you can get a hold of parameters and the whole shebang.
351
368
352
-
**Two routes** will be added:
369
+
**Three routes** will be added:
353
370
354
371
```
355
-
/emails/preview/<routeName>
356
-
/emails/send/<routeName>
372
+
/emails/preview/<routeName> # Preview as HTML
373
+
/emails/text/<routeName> # Preview as plain text
374
+
/emails/send/<routeName> # Send the email to an address
357
375
```
358
376
The `/emails` root prefix is configurable in `config` in the `routePrefix` key.
359
377
@@ -367,6 +385,7 @@ So for a template named `newsletterEmail`, the route names will be
367
385
368
386
```
369
387
previewNewsletterEmail
388
+
textNewsletterEmail
370
389
sendNewsletterEmail
371
390
```
372
391
@@ -443,19 +462,11 @@ and that will be used. The logger **must** support these methods:
443
462
444
463
Why not try [`meteor-logger`](https://github.com/lookback/meteor-logger)? :)
445
464
446
-
### Plain-text
447
-
By default, plain-text versions are automatically created from your html template and included in the final email. It's strongly advises to leave this option on, as it greatly reduces your emails' Spam score and the chance that your emails will end up in Spam folder of users. However, if you want to override this behaviour simply at this to `Mailer.init()`:
448
-
449
-
```coffeescript
450
-
Mailer.init(
451
-
settings:
452
-
plainText:false
453
-
)
454
-
```
455
-
456
465
## Version history
457
466
458
-
-`0.6.0` - Automatically create and include plain-text email version from your HTML templates
467
+
-`0.6.2` - Support passing options to `html-to-text` module in `Mailer.config()`.
468
+
-`0.6.1`- Fix critical runtime crash when sending emails.
469
+
-`0.6.0` - Automatically create and include plain text email version from your HTML templates, using [`html-to-text`](http://npmjs.com/package/html-to-text).
459
470
-`0.5.1` - Remove need for setting the `BUNDLE_PATH` environment variable ([#39](https://github.com/lookback/meteor-emails/pull/39)).
460
471
-`0.5.0` - Remove `node-sass` as hard dependency. SCSS support is now opt-in, by adding `chrisbutler:node-sass` to your app ([#35](https://github.com/lookback/meteor-emails/pull/35)).
461
472
-`0.4.6` - Fix paths on Windows in development mode.
0 commit comments