Class: Mushy::EmailBase
- Inherits:
-
Flux
- Object
- Flux
- Mushy::EmailBase
show all
- Defined in:
- lib/mushy/fluxs/smtp.rb
Direct Known Subclasses
Smtp
Instance Attribute Summary
Attributes inherited from Flux
#config, #flow, #id, #masher, #parent_fluxs, #subscribed_to, #type
Instance Method Summary
collapse
Methods inherited from Flux
#convert_this_to_an_array, #convert_to_symbolized_hash, #execute, #execute_single_event, #group_these_results, #guard, #ignore_these_results, inherited, #initialize, #join_these_results, #limit_these_results, #merge_these_results, #model_these_results, #outgoing_split_these_results, #shape_these, #sort_these_results, #standardize_these
Constructor Details
This class inherits a constructor from Mushy::Flux
Instance Method Details
#adjust(options) ⇒ Object
25
26
|
# File 'lib/mushy/fluxs/smtp.rb', line 25
def adjust options
end
|
#cleanup(options) ⇒ Object
28
29
30
31
32
|
# File 'lib/mushy/fluxs/smtp.rb', line 28
def cleanup options
options.tap do |hash|
hash.delete_if { |_, v| v.to_s == '' }
end
end
|
#get_via_options_from(config) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/mushy/fluxs/smtp.rb', line 34
def get_via_options_from config
{
address: config[:address],
port: config[:port].to_s,
user_name: config[:username],
password: config[:password],
domain: config[:domain],
authentication: :plain,
enable_starttls_auto: true,
}
end
|
#process(event, config) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/mushy/fluxs/smtp.rb', line 7
def process event, config
options = adjust(cleanup({
from: config[:from],
to: config[:to],
subject: config[:subject],
body: config[:body],
html_body: config[:html_body],
via_options: get_via_options_from(config)
}))
if (config[:attachment_file].to_s != '')
options[:attachments] = { config[:attachment_file].split("\/")[-1] => File.read(config[:attachment_file]) }
end
result = Pony.mail options
options.tap { |x| x.delete(:via_options) }
end
|