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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92373d5d37c490897dfc1415e736ffd53537d21f
4
- data.tar.gz: c361e5d9cc3e979c1e4b3e22b433012a4786284f
3
+ metadata.gz: 74c62e799bc4ccf823876cc5500615ff93067b8c
4
+ data.tar.gz: 8216916656991c7644ed1957fdb6d4f4b4641758
5
5
  SHA512:
6
- metadata.gz: 1911e2f3a088c4811fe8e0f04ed1e46d2f2ce6b1c3046b757dfa56a6e60cf25c610364e56e5cbf1282dfa7066efd311571d39d5b4f31aca2ad44d7e4963d57cd
7
- data.tar.gz: 6bd9b8adc9e4e63662cd437a0a6a3fd5c34dd751c941c8852d755a2ab722e703846a9d346c49edb5618a215ad04ccee9450ad2ae550fe846f6bb3852ba9314f2
6
+ metadata.gz: 9423b2cbcf208c57dfe374a57d25c31eaa8a1d685cd8c05089f213992888dccc70394de1191c06de5000354985a91270ccc71cb9edd37cff3b65e7f21172b308
7
+ data.tar.gz: 6fb1afa4ac1d75e827773af91fdc1d9777eee12472610ca28302a3df2433b95d5d4789c2e2dc5abd9e051b5a75369c1c63c45d49d3319463a14041990e3cdc1e
@@ -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
- body = <<EOT
9
- From: #{opts[:user]}
10
- To: #{opts[:address]}
11
- Subject: #{opts[:title]}
12
- Date: #{Time::now.strftime("%a, %d %b %Y %X %z")}
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
@@ -1,3 +1,3 @@
1
1
  module Blogpost
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/blogpost.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "atomutil"
2
2
  require "mail"
3
- require "net/smtp"
4
3
  require "xmlrpc/client"
5
4
  require "blogpost/version"
6
5
  require "blogpost/hatenablog"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blogpost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - shoprev