command_line_email 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ module CommandLineEmail
|
|
4
4
|
|
5
5
|
def self.parse(args, user_config)
|
6
6
|
|
7
|
-
mail_attrs = {to
|
7
|
+
mail_attrs = {:to => []}
|
8
8
|
|
9
9
|
option_parser = OptionParser.new do |opts|
|
10
10
|
|
@@ -52,7 +52,7 @@ module CommandLineEmail
|
|
52
52
|
|
53
53
|
def self.to_string_to_mailing_list(user_config, to, list=[])
|
54
54
|
# takes optional list in case you want to add to an existing list
|
55
|
-
if user_config.mailing_lists.has_key?
|
55
|
+
if user_config.mailing_lists && user_config.mailing_lists.has_key?(to.to_sym)
|
56
56
|
Array(user_config.mailing_lists[to.to_sym]).each { |address| list << address }
|
57
57
|
else
|
58
58
|
list << to
|
@@ -2,13 +2,13 @@ module CommandLineEmail
|
|
2
2
|
|
3
3
|
class DeliverEmail
|
4
4
|
|
5
|
-
def self.deliver(user_config, mail_attrs)
|
5
|
+
def self.deliver(user_config={}, mail_attrs={})
|
6
6
|
|
7
7
|
mail = Mail.new do
|
8
8
|
from mail_attrs[:from] || user_config.defaults[:from]
|
9
9
|
to mail_attrs[:to] || user_config.defaults[:to]
|
10
|
-
cc mail_attrs[:cc] || user_config.defaults[:cc] || nil
|
11
|
-
subject mail_attrs[:subject] || user_config.defaults[:subject] || ''
|
10
|
+
cc mail_attrs[:cc] || (user_config.defaults && user_config.defaults[:cc]) || nil
|
11
|
+
subject mail_attrs[:subject] || (user.config.defaults && user_config.defaults[:subject]) || ''
|
12
12
|
body mail_attrs[:body] ? grab_text_from_filename_if_file_exists(mail_attrs[:body]) : ''
|
13
13
|
if mail_attrs[:files]
|
14
14
|
attach_selected(mail_attrs[:files], mail_attrs[:directory] || '')
|