This repository was archived by the owner on Jan 22, 2021. It is now read-only.
File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
TAG = ' mailer'
9
9
10
+ # used to make plain-text version from html version
11
+ htmlToText = Npm .require ' html-to-text'
12
+
10
13
# ## Setup
11
14
12
15
# Main exported symbol with some initial settings:
@@ -27,6 +30,7 @@ Mailer =
27
30
disabled : false
28
31
addRoutes : process .env .NODE_ENV is ' development'
29
32
language : ' html'
33
+ plainText : true
30
34
31
35
juiceOpts :
32
36
preserveMediaQueries : true
@@ -226,6 +230,14 @@ MailerClass = (options) ->
226
230
# Render HTML with optional data context.
227
231
try
228
232
opts .html = render options .template , options .data
233
+
234
+ # create plain-text version from html
235
+ if settings .plainText
236
+ try
237
+ opts .text = htmlToText .fromString opts .html
238
+ catch ex
239
+ Utils .Logger .error " Could not make plain-text version from html: " + ex .message
240
+
229
241
catch ex
230
242
Utils .Logger .error ' Could not render email before sending: ' + ex .message , TAG
231
243
return false
Original file line number Diff line number Diff line change @@ -3,10 +3,14 @@ var where = 'server';
3
3
Package . describe ( {
4
4
name : 'lookback:emails' ,
5
5
summary : 'Send HTML emails with server side Blaze templates. Preview and debug in the browser.' ,
6
- version : '0.5.1 ' ,
6
+ version : '0.6.0 ' ,
7
7
git : 'https://github.com/lookback/meteor-emails.git'
8
8
} ) ;
9
9
10
+ Npm . depends ( {
11
+ "html-to-text" : "1.3.0"
12
+ } ) ;
13
+
10
14
Package . onUse ( function ( api ) {
11
15
12
16
api . versionsFrom ( '1.0.4' ) ;
You can’t perform that action at this time.
0 commit comments