simple_mail_builder 0.1.0 → 0.1.1

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: 491fbcb4035815dd0a9d1b427d99c63ba3977d51
4
- data.tar.gz: b02098db9e11f486d13988ed4809681f7493d187
3
+ metadata.gz: a3ad00a632fb2803af1e9b55bf22f34fab9b02e6
4
+ data.tar.gz: 40fa215f7675d53a544c512e4fe42260baa3b8e2
5
5
  SHA512:
6
- metadata.gz: aa5307bb25bfe318efaf1c27d7e0bbf6cdbc898f013e78f299092417d6733c5af06631b9d8c3b4666f0fffd2a0b66e62234f3f33913aaad706af0a139c01aeb2
7
- data.tar.gz: 808ce9eb28006662c925251c79402604df5024b58c27688dea659efaa2b1dfa52b9c49485ad4be631b64ef2e2ac4eb3a6ca5a47bbb586e1de4b1778d9570638b
6
+ metadata.gz: 67ede683e1eaffb4f743ebcaef48a18f0052ef62f0ffc78491a574ab8e531ce8cf7de85e3936bf8bc7cc8df7bbb06fc8b2d6d624e94b1d23a52b36af0fcea5e9
7
+ data.tar.gz: 8e70ecb268ceca9482d9660f0eb47249a25d7ed282431e976774a711e026248b5239f0fac057c32f40c00384c1053d1b277c9838a0bc60513cd89e93b275a0b2
data/README.md CHANGED
@@ -50,7 +50,9 @@ Or install it yourself as:
50
50
  require 'simple_mail_builder'
51
51
  message = SimpleMailBuilder::Message.new(
52
52
  to: {'Recipient' => 'to@domain.com'},
53
- from: 'from@domain.com', subject: 'Message subject',
53
+ from: 'from@domain.com',
54
+ reply_to: 'reply-to@domain.com',
55
+ subject: 'Message subject',
54
56
  text: "Header\n\nFirst line\nLast line",
55
57
  html: '<h1>Header</h1><p>First line</p><p>Last line</p>'
56
58
  ).to_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleMailBuilder
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -8,10 +8,10 @@ require_relative 'simple_mail_builder/encoder/base64'
8
8
 
9
9
  module SimpleMailBuilder
10
10
  class Message
11
- def initialize(from: , to: , subject: , text: , html: , boundary: '--MESSAGE BOUNDARY--',
12
- date: Time.now, domain: 'local.mail')
13
- from, to = [from, to].map do |address|
14
- next address if String === address # otherwise we assume it's a Hash
11
+ def initialize(from:, to:, subject:, text:, html:, reply_to: nil,
12
+ boundary: '--MESSAGE BOUNDARY--', date: Time.now, domain: 'local.mail')
13
+ from, to, reply_to = [from, to, reply_to].map do |address|
14
+ next address if address.nil? || String === address # otherwise we assume it's a Hash
15
15
  address.map do |name, email|
16
16
  name == email ? email : "#{Encoder::Base64.encode_or_quote(name)} <#{email}>"
17
17
  end.join ", \r\n "
@@ -22,6 +22,7 @@ module SimpleMailBuilder
22
22
  message << "Date: #{fdate}"
23
23
  message << "From: #{from}"
24
24
  message << "To: #{to}"
25
+ message << "Reply-to: #{reply_to}" if reply_to
25
26
  message_id = Digest::MD5.hexdigest [fdate, to, text, html].join
26
27
  message << "Message-ID: <#{message_id}@#{domain}>"
27
28
  message << "Subject: #{Encoder::Quote.encode_if_required subject}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_mail_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Rosenfeld Rosas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-06 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler