11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/wfstatus.rb', line 11
def self.process(config)
options = {
address: config['smtp']['address'],
port: config['smtp']['port'],
domain: config['smtp']['domain'],
user_name: config['smtp']['user_name'],
password: config['smtp']['password'],
authentication: config['smtp']['authentication'],
enable_starttls_auto: config['smtp']['enable_starttls_auto']
}
url = config['blog_url']
puts url
parser = Parser.new( open(url), config )
builder = Builder.new(config, parser.messages)
return unless builder.relevant_messages.count > 0
Mail.defaults do
delivery_method :smtp, options
end
mail = Mail.new do
from config['mail']['from']
to config['mail']['to']
subject config['mail']['subject']
body builder.content
end
puts mail.to_s
mail.deliver!
end
|