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.
- checksums.yaml +4 -4
- data/bin/trikle-mail +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d4893cd70f9c06b996c6fb6e836d286b49d9f1
|
4
|
+
data.tar.gz: 743d5bf00407d3a037ba23d1e5de77fb5b3a824a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9e0bd7203ce7a7af339f53129d0f6441c2cb202d0c118309448499eabdac39bbd7869f558d318f7e3ed11d10bb2f63a5bbc758ea8e97c5685d9299ac8c754ce
|
7
|
+
data.tar.gz: f07592534deba8b7ac50d29e44fbbc2f9caffa897e4415f3c0c1390d7a3721a698a32b1e304c518ef93087a0085621252e42c84e39f0dfe5a2f9733cf33bd1c6
|
data/bin/trikle-mail
CHANGED
@@ -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
|
-
|
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, {
|