ruboty-sendmail 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/ruboty/handlers/sendmail.rb +13 -3
- data/lib/ruboty/sendmail/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d617e331904ddb0e665f8cd3d764d9f80f2cda59
|
4
|
+
data.tar.gz: f493fec59ed57eb8f417b95491a40cbff70a2360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd688b46cec8645d905c77d63ceedf593a424189ed5133f497dfe5e4aec67a4031157ebacc138ff9b4081f6f7b593ef321857611d84d4a25ea05568091823e57
|
7
|
+
data.tar.gz: 1cfe5fbcd6760cadff99139cf2c80ac521cc1a17a24a2d6321221ed8a973b6ef9f6045f85eac6e1073d0d7a58df350a8d1b6e3e6b66a35b99f0d3b348bf1e12b
|
@@ -10,11 +10,14 @@ module Ruboty
|
|
10
10
|
def sendmail(message)
|
11
11
|
mail_config = YAML.load_file("#{ENV['HOME']}/.ruboty-sendmail.yml")
|
12
12
|
|
13
|
+
address = trim_address(message[:address])
|
14
|
+
body = message[:body]
|
15
|
+
|
13
16
|
mail = Mail.new do |config|
|
14
|
-
config.subject mail_config['subject'] || 'Send by ruboty-sendmail'
|
15
17
|
config.from mail_config['from']
|
16
|
-
config.to
|
17
|
-
config.
|
18
|
+
config.to address
|
19
|
+
config.subject mail_config['subject'] || 'Send by ruboty-sendmail'
|
20
|
+
config.body body
|
18
21
|
end
|
19
22
|
|
20
23
|
method = mail_config['method'] || :smtp
|
@@ -42,6 +45,13 @@ module Ruboty
|
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
48
|
+
private
|
49
|
+
|
50
|
+
def trim_address(string)
|
51
|
+
match_data = string.match(/(?<address>\w+[\w\.-]*@\w+[\w\.-]+)/)
|
52
|
+
match_data[:address]
|
53
|
+
end
|
54
|
+
|
45
55
|
def symbolize_keys(hash)
|
46
56
|
hash.each_with_object({}) do |(k, v), retval|
|
47
57
|
retval[k.to_sym] = v
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-sendmail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|