dcidev_mailer 0.0.3 → 0.0.7
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/mandrill.rb +5 -3
- data/lib/dcidev_mailer/rails.rb +20 -21
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a094879390e6716b70f8229366ba24f1a84c0b1aac5f7565035258326ce071f
|
4
|
+
data.tar.gz: bece3752e7a948a9ad67e1687d8b06be4ac5e54eb90859e6eb802280c14e18b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 707e59fb856b39ee66f8081998167e7df4e2e5307416e8fb3e0c41c5c480334e475639a3c5965e3031997edffb5fb7b6eab005e89891912c14f4918f58290f6c
|
7
|
+
data.tar.gz: edbefefe835b479c602dc4538200fa3ef52246ecd081586ae77bae98ed861c28f53e53ca3e932421c50fe33471e4ae355dc6345f886cd2c7da182899b1164536
|
@@ -5,21 +5,23 @@ module DcidevMailer
|
|
5
5
|
default from: ENV['DEFAULT_EMAIL_SENDER']
|
6
6
|
|
7
7
|
class << self
|
8
|
-
def send_email(subject: "", html_body: "", to: nil, from: nil, attachments: nil, email_template_path: "", header_url: "", footer_url: "")
|
8
|
+
def send_email(subject: "", html_body: "", to: nil, cc: nil, bcc: nil, from: nil, attachments: nil, email_template_path: "", header_url: "", footer_url: "")
|
9
9
|
ac = ActionController::Base.new
|
10
10
|
wording, images = DcidevMailer.format_image_from_html(html_body)
|
11
11
|
locals = {wording: wording, header: nil, footer: nil}
|
12
12
|
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?
|
13
13
|
html_body = ac.render_to_string(template: email_template_path, locals: locals)
|
14
14
|
attachments = DcidevMailer.format_attachments(attachments) if attachments.present?
|
15
|
-
self.send_mail(subject, to, html_body, attachments, images, from).deliver_now
|
15
|
+
self.send_mail(subject, to,cc, bcc, html_body, attachments, images, from).deliver_now
|
16
16
|
end
|
17
17
|
|
18
|
-
def send_mail(subject, to, html, attachments = nil, images = nil, from = nil)
|
18
|
+
def send_mail(subject, to, cc, bcc, html, attachments = nil, images = nil, from = nil)
|
19
19
|
mandrill_mail subject: subject,
|
20
20
|
from: from,
|
21
21
|
# to: "dev.puntodamar@gmail.com",
|
22
22
|
to: to,
|
23
|
+
cc: cc,
|
24
|
+
bcc: bcc,
|
23
25
|
# to: { email: invitation.email, name: 'Honored Guest' },
|
24
26
|
html: html,
|
25
27
|
view_content_link: true,
|
data/lib/dcidev_mailer/rails.rb
CHANGED
@@ -1,30 +1,29 @@
|
|
1
1
|
require 'mail'
|
2
2
|
|
3
3
|
module DcidevMailer
|
4
|
-
|
5
|
-
|
4
|
+
class Rails < ActionMailer::Base
|
5
|
+
default from: ENV['DEFAULT_EMAIL_SENDER']
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
class << self
|
8
|
+
def email(html_body: "", header_url: "", footer_url: "", file_attachments: nil, to: "", from: nil, subject: "")
|
9
|
+
wording, images = DcidevMailer.format_image_from_html(html_body)
|
10
|
+
locals = {wording: wording, header: nil, footer: nil}
|
11
|
+
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?
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
attachments.inline['header'] = File.read(Utility.download_to_file(header_url)) rescue nil if header_url.present?
|
20
|
-
attachments.inline['footer'] = File.read(Utility.download_to_file(footer_url)) rescue nil if footer_url.present?
|
13
|
+
if file_attachments.present?
|
14
|
+
file_attachments.each do |a|
|
15
|
+
attachments[a[:name].to_s] = a[:content] unless a[:content].nil?
|
16
|
+
end
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
attachments.inline['header'] = File.read(Utility.download_to_file(header_url)) rescue nil if header_url.present?
|
20
|
+
attachments.inline['footer'] = File.read(Utility.download_to_file(footer_url)) rescue nil if footer_url.present?
|
21
|
+
|
22
|
+
mail(to: to, subject: subject, format: "text/html", from: from) do |format|
|
23
|
+
format.html {
|
24
|
+
render locals: locals
|
25
|
+
}
|
26
|
+
end
|
26
27
|
end
|
27
|
-
end
|
28
28
|
end
|
29
|
-
end
|
30
29
|
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.7
|
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-01-
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mimemagic
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.2.3
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: Commonly used email codes
|