blogpost 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blogpost/sendmail.rb +13 -11
- data/lib/blogpost/version.rb +1 -1
- data/lib/blogpost.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c62e799bc4ccf823876cc5500615ff93067b8c
|
4
|
+
data.tar.gz: 8216916656991c7644ed1957fdb6d4f4b4641758
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9423b2cbcf208c57dfe374a57d25c31eaa8a1d685cd8c05089f213992888dccc70394de1191c06de5000354985a91270ccc71cb9edd37cff3b65e7f21172b308
|
7
|
+
data.tar.gz: 6fb1afa4ac1d75e827773af91fdc1d9777eee12472610ca28302a3df2433b95d5d4789c2e2dc5abd9e051b5a75369c1c63c45d49d3319463a14041990e3cdc1e
|
data/lib/blogpost/sendmail.rb
CHANGED
@@ -5,18 +5,20 @@ module Blogpost
|
|
5
5
|
opts[:port] = "25" unless opts.key?(:port)
|
6
6
|
opts[:host] = "localhost" unless opts.key?(:host)
|
7
7
|
opts[:user] = "from@example.com" unless opts.key?(:user)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Content-Type: text/html; charset=UTF-8
|
14
|
-
|
15
|
-
#{opts[:content]}
|
16
|
-
EOT
|
17
|
-
Net::SMTP.start(opts[:host], opts[:port]) do |smtp|
|
18
|
-
smtp.send_mail body, opts[:user], opts[:address]
|
8
|
+
options = { :address => opts[:host],
|
9
|
+
:port => opts[:port],
|
10
|
+
:enable_starttls_auto => false }
|
11
|
+
Mail.defaults do
|
12
|
+
delivery_method :smtp, options
|
19
13
|
end
|
14
|
+
mail = Mail.new do
|
15
|
+
to opts[:address]
|
16
|
+
from opts[:user]
|
17
|
+
subject opts[:title]
|
18
|
+
body opts[:content]
|
19
|
+
content_type 'text/html; charset=UTF-8'
|
20
|
+
end
|
21
|
+
mail.deliver
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
data/lib/blogpost/version.rb
CHANGED
data/lib/blogpost.rb
CHANGED