trikle-mail 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/trikle-mail +14 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ae726b20a132beb497b8bdbee1078af61dc4a0a
4
- data.tar.gz: 4cf793465fcdd362ffa97162b721a80494b948ff
3
+ metadata.gz: d1d4893cd70f9c06b996c6fb6e836d286b49d9f1
4
+ data.tar.gz: 743d5bf00407d3a037ba23d1e5de77fb5b3a824a
5
5
  SHA512:
6
- metadata.gz: 244dc76d34e37e445262421580dc2eb30c6cfe95243df9418bcb049722a5ea07c107112f029cdf575d73f47cc6545213c94791d63bd3d1b7dd7c8b5ecf9f46c0
7
- data.tar.gz: dea0cd0f556f008ae175d68a3645fa88512cc5edd138df2ab84518f5f1320635d8f56eb4a9cc04869adfeb8a67a2027efeced4eccf4274e04a9009b1d31ecf6d
6
+ metadata.gz: e9e0bd7203ce7a7af339f53129d0f6441c2cb202d0c118309448499eabdac39bbd7869f558d318f7e3ed11d10bb2f63a5bbc758ea8e97c5685d9299ac8c754ce
7
+ data.tar.gz: f07592534deba8b7ac50d29e44fbbc2f9caffa897e4415f3c0c1390d7a3721a698a32b1e304c518ef93087a0085621252e42c84e39f0dfe5a2f9733cf33bd1c6
@@ -22,6 +22,7 @@ class TrikleMail
22
22
  c.option '--password STRING', String, 'Password to authenticate with mail server'
23
23
  c.option '--from STRING', String, 'The email address to send the email from'
24
24
  c.option '--template STRING', String, 'The template to use to send the message'
25
+ c.option '--html', 'toggle using html to format email, defaults to no'
25
26
  c.option '--subject STRING', String, 'The subject line of the message'
26
27
  c.option '--hours INTEGER', Integer, 'The number of hours over which to send the emails'
27
28
  c.option '--minutes INTEGER', Integer, 'The number of minutes over which to send the emails'
@@ -35,7 +36,8 @@ class TrikleMail
35
36
  end.to_h
36
37
  end
37
38
 
38
- options.default({hours: 0, minutes: 0})
39
+ options.default({hours: 0, minutes: 0, html: false})
40
+
39
41
  time_range = ((options.hours * 60 * 60) + (options.minutes * 60)) /
40
42
  data_hashes.length.to_f
41
43
 
@@ -45,7 +47,17 @@ class TrikleMail
45
47
  from hash.fetch(:from, options.from)
46
48
  to hash.fetch(:to, hash.fetch(:email) { raise 'no email address found in to column!' })
47
49
  subject hash.fetch(:subject, options.subject)
48
- body File.read(hash.fetch(:template, options.template)) % hash
50
+
51
+ if options.html
52
+ html_part do
53
+ content_type 'text/html; charset=UTF-8'
54
+ body File.read(hash.fetch(:template, options.template)) % hash
55
+ end
56
+ else
57
+ text_part do
58
+ body File.read(hash.fetch(:template, options.template)) % hash
59
+ end
60
+ end
49
61
  end
50
62
 
51
63
  mail.delivery_method :smtp, {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trikle-mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jasper Lyons