mattmatt-cijoe 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cijoe/email.rb +7 -6
- data/lib/cijoe/version.rb +1 -1
- data/lib/mmmail.rb +5 -0
- metadata +1 -1
data/lib/cijoe/email.rb
CHANGED
@@ -17,7 +17,7 @@ class CIJoe
|
|
17
17
|
puts "\tuser = horst"
|
18
18
|
puts "\tpass = passw0rd"
|
19
19
|
puts "\thost = mail.example.com"
|
20
|
-
puts "\
|
20
|
+
puts "\tauthtype = login"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,7 +27,7 @@ class CIJoe
|
|
27
27
|
:user => Config.email.user.to_s,
|
28
28
|
:pass => Config.email.pass.to_s,
|
29
29
|
:host => Config.email.host.to_s,
|
30
|
-
:
|
30
|
+
:auth_type => Config.email.authtype.to_s
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
@@ -41,17 +41,18 @@ class CIJoe
|
|
41
41
|
options = {
|
42
42
|
:to => Email.config[:to],
|
43
43
|
:from => Email.config[:to],
|
44
|
-
:subject => "(#{
|
44
|
+
:subject => "(#{project}) Build failed",
|
45
45
|
:body => mail_body
|
46
46
|
}
|
47
|
-
MmMail.
|
47
|
+
MmMail.mail(options, mail_config) if failed?
|
48
48
|
end
|
49
49
|
|
50
50
|
def mail_config
|
51
|
-
config = MmMail::Config.new
|
51
|
+
config = MmMail::Transport::Config.new
|
52
52
|
config.auth_user = Email.config[:user]
|
53
53
|
config.auth_pass = Email.config[:pass]
|
54
|
-
config.auth_type = Email.config[:
|
54
|
+
config.auth_type = Email.config[:auth_type].to_sym
|
55
|
+
config.host = Email.config[:host]
|
55
56
|
config
|
56
57
|
end
|
57
58
|
|
data/lib/cijoe/version.rb
CHANGED
data/lib/mmmail.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# http://github.com/lsegal/mmmail/
|
3
3
|
|
4
4
|
require 'net/smtp'
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/smtp_tls')
|
5
6
|
|
6
7
|
module MmMail
|
7
8
|
# General exception class when something goes wrong in MmMail
|
@@ -29,6 +30,9 @@ module MmMail
|
|
29
30
|
class Config
|
30
31
|
# Set/get the SMTP host/port information
|
31
32
|
attr_accessor :host, :port
|
33
|
+
|
34
|
+
# Enable TLS
|
35
|
+
attr_accessor :enable_tls
|
32
36
|
|
33
37
|
# Set/get the authentication type (nil for none, :plain, :login or :cram_md5)
|
34
38
|
attr_accessor :auth_type
|
@@ -105,6 +109,7 @@ module MmMail
|
|
105
109
|
#
|
106
110
|
# @param [#to_s] message the message to send
|
107
111
|
def mail_smtp(message)
|
112
|
+
Net::SMTP.enable_tls
|
108
113
|
Net::SMTP.start(config.host, config.port, 'localhost.localdomain',
|
109
114
|
config.auth_user, config.auth_pass, config.auth_type) do |smtp|
|
110
115
|
smtp.send_message(message.to_s, message.from, message.recipients_list)
|