dcidev_mailer 0.0.12 → 0.0.13

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -9
  3. data/lib/dcidev_mailer.rb +10 -14
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92cf0dc63352424606b22ecfccce05ea3daa10fce535898e1e37c85095735ff2
4
- data.tar.gz: 15ed559e1470ce64ed6f49b6dd7445ff27e7048b4445fb600e16392a18246430
3
+ metadata.gz: 5a56a9c54429232d7fd7d01cc3f657534537ca554886d5d77aa30c8f7ae93567
4
+ data.tar.gz: 7404b2af018fe76212836484eb364b42ec5375c84d4f9a00844ae20ad2201c62
5
5
  SHA512:
6
- metadata.gz: b27fd936d828b8f08b1a06f0f77bed785a96d6770fa9762dfe4de8d9ade9a02687f9eec3537e4ab40caa0c07fc62701f00cf73184fcfdc30a3c5139d4f71a0fa
7
- data.tar.gz: 424b1ab0c90d99a540fa508a1be07c04c50d1405285354793d33c5130db8395a466ea24ae17a250af2ae20562a87ea08ac29504f8f824916c215fb820267d3b2
6
+ metadata.gz: db523c536b6164e8830f4de07d94ccb00d27c8fa6341748747830dcb45e2d7a1e147a3226837457da585c2942caeea818ee39e25bd2d5623ce53d2947bc6fdbc
7
+ data.tar.gz: 85ac24510c11d94287baffe97b5a728badfb9ab8040297908a03061fc42c9db209cd04e8ee3c62391c6e7ff83bf11ff1db2123b7577b7099f27dc1584814f499
data/README.md CHANGED
@@ -27,13 +27,12 @@ MAILER_SMTP_TLS=
27
27
 
28
28
  Add this to `config/initializer/mailer.rb`
29
29
  ```ruby
30
- ActionMailer::Base.delivery_method =: smtp
30
+ ActionMailer::Base.delivery_method = :smtp
31
31
 
32
32
  # change it to your helper class name
33
33
  ActionMailer::Base.add_delivery_method: mandrill_mailer, MandrillMailer
34
34
 
35
- # uncomment
36
- if neccessary
35
+ # uncomment if neccessary
37
36
  smtp_settings = {
38
37
  address: ENV["USE_MANDRILL_MAILER"].to_i == 1 ? ENV['MANDRILL_SMTP_ADDRESS'] : ENV["MAILER_SMTP_ADDRESS"],
39
38
  # authentication: ENV["USE_MANDRILL_MAILER"].to_i == 1 ? 'plain' : nil,
@@ -47,15 +46,15 @@ smtp_settings = {
47
46
  }
48
47
 
49
48
  if ENV["USE_MANDRILL_MAILER"].to_i == 1
50
- smtp_settings[: authentication] = 'plain'
51
- smtp_settings[: password] = ENV['MANDRILL_SMTP_PASSWORD']
52
- smtp_settings[: user_name] = ENV['MANDRILL_SMTP_USERNAME']
49
+ smtp_settings[:authentication] = 'plain'
50
+ smtp_settings[:password] = ENV['MANDRILL_SMTP_PASSWORD']
51
+ smtp_settings[:user_name] = ENV['MANDRILL_SMTP_USERNAME']
53
52
  end
54
53
 
55
54
  ActionMailer::Base.smtp_settings = smtp_settings
56
55
 
57
56
  ActionMailer::Base.default_url_options = {
58
- : host => ENV["BASE_URL_FE"]
57
+ host: ENV["BASE_URL_FE"]
59
58
  }
60
59
  ActionMailer::Base.register_preview_interceptor(ActionMailer::InlinePreviewInterceptor)
61
60
 
@@ -134,7 +133,7 @@ class MortgageMailer
134
133
  subject: template.subject,
135
134
  from: ENV['DEFAULT_EMAIL_SENDER'],
136
135
  template_path: "mail/blast.html.erb" # specify template file location
137
- )
136
+ ).deliver_now
138
137
  rescue => e
139
138
  error_message = "[SEND EMAIL] " + e.try(:to_s)
140
139
  ensure
@@ -161,6 +160,6 @@ DcidevMailer::format_image_from_html(html)
161
160
  DcidevMailer::format_attachments(attachments)
162
161
 
163
162
  # format email header & footer url to be embedded to html body
164
- # refer to class DcidevMailer::Mandrill or DcidevMailer::Rails to understand more of this method
163
+ # refer to class DcidevMailer::Mandrill or DcidevMailer::Rails for more details about the usage
165
164
  DcidevMailer::format_header_footer(header_url: "", footer_url: "", locals: {}, images: {})
166
165
  ```
data/lib/dcidev_mailer.rb CHANGED
@@ -18,20 +18,16 @@ module DcidevMailer
18
18
  def format_attachments(attachments)
19
19
  formatted = []
20
20
  attachments.each do |a|
21
- begin
22
- filetype = MimeMagic.by_magic(a[:file]).type.to_s
23
- content = a[:file].read
24
- name = "#{a[:filename]}.#{filetype.split("/")[1]}"
25
- att = {
26
- content: content,
27
- name: name,
28
- }
29
-
30
- att[:type] = filetype if ENV["USE_MANDRILL_MAILER"].to_i == 0
31
- formatted << att
32
- rescue => _
33
-
34
- end
21
+ filetype = MimeMagic.by_magic(a[:file]).type.to_s
22
+ content = a[:file].read
23
+ name = "#{a[:filename]}.#{filetype.split("/")[1]}"
24
+ att = {
25
+ content: content,
26
+ name: name,
27
+ }
28
+
29
+ att[:type] = filetype if ENV["USE_MANDRILL_MAILER"].to_i == 0
30
+ formatted << att
35
31
  end
36
32
  formatted
37
33
  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.12
4
+ version: 0.0.13
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-12 00:00:00.000000000 Z
11
+ date: 2022-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mimemagic