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 +4 -4
- data/README.md +3 -1
- data/lib/simple_mail_builder/version.rb +1 -1
- data/lib/simple_mail_builder.rb +5 -4
- 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: a3ad00a632fb2803af1e9b55bf22f34fab9b02e6
|
4
|
+
data.tar.gz: 40fa215f7675d53a544c512e4fe42260baa3b8e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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',
|
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
|
data/lib/simple_mail_builder.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|