trikle-mail 0.0.7 → 0.0.9
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 +8 -2
- data/lib/triklemailer.rb +8 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d9a65541914cfad901296c5d39cb0fb173ecc85390886f8902f8006d39d37bc
|
4
|
+
data.tar.gz: 0e4ebb9c03c7e2f2a34ab263f6aaa69584cf25095f39e65d89c0a795be503035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a696c2c3cfb540c202ba997a2f6f553a5031f1d389a3665da7af0558106fc1bf845b9383c7389949097d9a2dbd891229cefd57799da25ceb0c053c33832bb0cb
|
7
|
+
data.tar.gz: 1dd588e80b309f9673e1e9c0f968d6b53e0eb30fc38aa10d27516bf5ec4e2977eca3dd506c0378e81ed48724e003d0ffa6928168bfc0c3dd220ad01353f4ebc2
|
data/bin/trikle-mail
CHANGED
@@ -19,12 +19,15 @@ class TrikleMail
|
|
19
19
|
c.description = 'Send a message to each email in the csv using the template'
|
20
20
|
c.option '--host STRING', String, 'The host of the mail server e.g. <mail.gmail.com>'
|
21
21
|
c.option '--port INTEGER', Integer, 'Port number of the mail server e.g. 587'
|
22
|
+
c.option '--domain STRING', String, 'Domain that emails are comming from'
|
22
23
|
c.option '--username STRING', String, 'Username to authenticate with mail server'
|
23
24
|
c.option '--password STRING', String, 'Password to authenticate with mail server'
|
24
25
|
c.option '--from STRING', String, 'The email address to send the email from'
|
26
|
+
c.option '--bcc STRING', String, 'The email address to bcc each message to'
|
27
|
+
c.option '--subject STRING', String, 'The subject line of the message'
|
25
28
|
c.option '--template STRING', String, 'The template to use to send the message'
|
29
|
+
c.option '--attachment STTRING', String, 'The relative file path to your attachement'
|
26
30
|
c.option '--html', 'toggle using html to format email, defaults to no'
|
27
|
-
c.option '--subject STRING', String, 'The subject line of the message'
|
28
31
|
c.option '--hours INTEGER', Integer, 'The number of hours over which to send the emails'
|
29
32
|
c.option '--minutes INTEGER', Integer, 'The number of minutes over which to send the emails'
|
30
33
|
|
@@ -43,11 +46,14 @@ class TrikleMail
|
|
43
46
|
template_name: options.template,
|
44
47
|
is_html: options.template.end_with?('html'),
|
45
48
|
from: options.from,
|
49
|
+
bcc: options.bcc,
|
46
50
|
subject: options.subject,
|
47
51
|
port: options.port,
|
48
52
|
host: options.host,
|
49
53
|
username: options.username,
|
50
|
-
password: options.password
|
54
|
+
password: options.password,
|
55
|
+
domain: options.domain,
|
56
|
+
attachment: options.attachment
|
51
57
|
)
|
52
58
|
|
53
59
|
Triklemailer.send_mail(mail_options, recipients, sent)
|
data/lib/triklemailer.rb
CHANGED
@@ -2,10 +2,11 @@ require 'mail'
|
|
2
2
|
require 'csv'
|
3
3
|
|
4
4
|
module Triklemailer
|
5
|
-
VERSION = '0.0.
|
5
|
+
VERSION = '0.0.9'
|
6
6
|
Options = Struct.new(
|
7
7
|
:template, :template_name, :is_html, :from, :subject,
|
8
|
-
:host, :port, :username, :password,
|
8
|
+
:host, :port, :username, :password, :bcc, :domain,
|
9
|
+
:attachment,
|
9
10
|
keyword_init: true
|
10
11
|
)
|
11
12
|
|
@@ -47,6 +48,7 @@ module Triklemailer
|
|
47
48
|
to recipient.fetch(:to, recipient.fetch(:email) {
|
48
49
|
raise "Some rows are missing either a 'to' or 'email' column."
|
49
50
|
})
|
51
|
+
bcc options.bcc if options.bcc
|
50
52
|
subject recipient.fetch(:subject, options.subject)
|
51
53
|
|
52
54
|
if options.is_html
|
@@ -59,6 +61,8 @@ module Triklemailer
|
|
59
61
|
body cleaned_template % recipient
|
60
62
|
end
|
61
63
|
end
|
64
|
+
|
65
|
+
add_file(File.expand_path(options.attachment)) if options.attachment
|
62
66
|
end
|
63
67
|
|
64
68
|
if block_given?
|
@@ -82,7 +86,9 @@ module Triklemailer
|
|
82
86
|
options.template_name)
|
83
87
|
rescue => e
|
84
88
|
puts "Failed to send email to #{recipient[:email]}."
|
89
|
+
puts e.class
|
85
90
|
puts e
|
91
|
+
puts e.backtrace
|
86
92
|
next
|
87
93
|
end
|
88
94
|
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trikle-mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jasper Lyons
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-10-18 00:00:00.000000000 Z
|
@@ -107,7 +107,7 @@ homepage: ''
|
|
107
107
|
licenses:
|
108
108
|
- MIT
|
109
109
|
metadata: {}
|
110
|
-
post_install_message:
|
110
|
+
post_install_message:
|
111
111
|
rdoc_options: []
|
112
112
|
require_paths:
|
113
113
|
- lib
|
@@ -122,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
126
|
-
signing_key:
|
125
|
+
rubygems_version: 3.1.4
|
126
|
+
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Send a trickle of mail
|
129
129
|
test_files: []
|