dcidev_mailer 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dcidev_mailer/rails_mailer.rb +19 -36
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f3f6f2bc44b3d45a845f89bc2922dfb527a8a3fd98156b444a46fb1920ef355
|
4
|
+
data.tar.gz: e395df17cc4a719004e7d58b513aaa8d534032c335b82e34054380c08fa427be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26926484cb0021436d5a9f9d74a9927d3220f6bdea7438c9d6ba99ea104c21290fde491c60af8f413772e01df74e79cc12f6e8fa3c54d3879a7716caa9be83fd
|
7
|
+
data.tar.gz: f82ebb6124f7425de9fc3b2b6bd8e09122f8514b3137dfb7e23ce31dfecf48e99c5e6dd5284f08aead7157ce8e0fce736b7445e9743c57589fe6377e16ab04a0
|
@@ -5,6 +5,7 @@ require 'mail'
|
|
5
5
|
require 'dcidev_mailer/errors/invalid_recipients'
|
6
6
|
require 'dcidev_mailer/errors/invalid_body'
|
7
7
|
require 'dcidev_mailer/errors/invalid_template'
|
8
|
+
|
8
9
|
module DcidevMailer
|
9
10
|
class RailsMailer < ActionMailer::Base
|
10
11
|
|
@@ -15,7 +16,7 @@ module DcidevMailer
|
|
15
16
|
wording, images = DcidevMailer.format_image_from_html(html_body)
|
16
17
|
|
17
18
|
locals = { wording: wording, header: nil, footer: nil }
|
18
|
-
locals,
|
19
|
+
locals, _ = DcidevMailer.format_header_footer(header_url: header_url, footer_url: footer_url, locals: locals, images: images) if header_url.present? || footer_url.present?
|
19
20
|
|
20
21
|
file_attachments = DcidevMailer.format_attachments(file_attachments) if file_attachments.present?
|
21
22
|
if file_attachments.present?
|
@@ -24,8 +25,23 @@ module DcidevMailer
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
begin
|
29
|
+
header_file = File.read(DcidevUtility.download_to_file(header_url))
|
30
|
+
header_mime = MimeMagic.by_magic(header_file)
|
31
|
+
attachments.inline['header'] = header_file
|
32
|
+
attachments.inline['header']['content-type'] = header_mime
|
33
|
+
attachments.inline['header']['content-id'] = '<header>'
|
34
|
+
rescue => _
|
35
|
+
end
|
36
|
+
|
37
|
+
begin
|
38
|
+
footer_file = File.read(DcidevUtility.download_to_file(footer_url))
|
39
|
+
footer_mime = MimeMagic.by_magic(footer_file)
|
40
|
+
attachments.inline['footer'] = footer_file
|
41
|
+
attachments.inline['footer']['content-type'] = footer_mime
|
42
|
+
attachments.inline['footer']['content-id'] = '<footer>'
|
43
|
+
rescue => _
|
44
|
+
end
|
29
45
|
|
30
46
|
mail(
|
31
47
|
to: to,
|
@@ -43,38 +59,5 @@ module DcidevMailer
|
|
43
59
|
}
|
44
60
|
end
|
45
61
|
end
|
46
|
-
|
47
|
-
|
48
|
-
# def self.method_missing(method_name, html_body: "", header_url: "", footer_url: "", file_attachments: nil, to: nil, cc: nil, bcc: nil, from: nil, subject: "")
|
49
|
-
# raise DcidevMailer::Errors::InvalidRecipients unless to.present?
|
50
|
-
# raise DcidevMailer::Errors::InvalidBody unless html_body.present? && html_body.is_a?(String)
|
51
|
-
# wording, images = DcidevMailer.format_image_from_html(html_body)
|
52
|
-
#
|
53
|
-
# locals = { wording: wording, header: nil, footer: nil }
|
54
|
-
# locals, images = DcidevMailer.format_header_footer(header_url: header_url, footer_url: footer_url, locals: locals, images: images) if header_url.present? && footer_url.present?
|
55
|
-
#
|
56
|
-
# if file_attachments.present?
|
57
|
-
# file_attachments.each do |a|
|
58
|
-
# am.attachments[a[:name].to_s] = a[:content] unless a[:content].nil?
|
59
|
-
# end
|
60
|
-
# end
|
61
|
-
#
|
62
|
-
# attachments.inline['header'] = File.read(Utility.download_to_file(header_url)) rescue nil if header_url.present?
|
63
|
-
# attachments.inline['footer'] = File.read(Utility.download_to_file(footer_url)) rescue nil if footer_url.present?
|
64
|
-
#
|
65
|
-
# mail(
|
66
|
-
# to: to,
|
67
|
-
# cc: cc,
|
68
|
-
# bcc: bcc,
|
69
|
-
# subject: subject,
|
70
|
-
# format: "text/html",
|
71
|
-
# from: from,
|
72
|
-
# ) do |format|
|
73
|
-
# format.html {
|
74
|
-
# render locals: locals
|
75
|
-
# }
|
76
|
-
# end
|
77
|
-
# end
|
78
|
-
|
79
62
|
end
|
80
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dcidev_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Punto Damar P
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mimemagic
|