-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail_send.rb
26 lines (25 loc) · 894 Bytes
/
mail_send.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require './spec_helper'
class SendMail
def self.mail_about_low_price(price, item_name, link, result, selling_out)
if price > 0 && result == true || selling_out == true
Pony.mail(
{ to: ENV['EMAIL_TO'],
subject: "Hurry up!!! LowPrice on #{item_name} !!!",
body: "#{item_name} #{price} RUB https://www.mvideo.ru#{link}",
charset: 'UTF-8',
via: :smtp,
attachments: { file = Dir['./screenshots/*.png'].first => File.read(file) },
via_options: {
user_name: ENV['EMAIL_FROM'],
password: ENV['PASSWORD'],
address: 'smtp.gmail.com',
port: '587',
authentication: :plain,
enable_starttls_auto: true,
}
}
)
puts 'Mail send'
end
end
end