html2mail 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7585a504567c1adeebae71f5a0d8570a7114c5f
4
- data.tar.gz: 718d53f3c8193a8edcbca0905b3fac9b7ff356ba
3
+ metadata.gz: b7c04c6648b91c849bea8bda385e88a45600556c
4
+ data.tar.gz: b04d6c440551d39df6a1ec78369fbcad12cf4fe4
5
5
  SHA512:
6
- metadata.gz: 11d956773ad118c382742516fd8210b9b80864cff7c30d9c2c632306798c0973d0b1db031751024a45c8fe69ca655b94a849085776c202255d3978a95e8a00e4
7
- data.tar.gz: 6004eb20a796a3b68c3b9d429c2fcbb1c16d236e26a831e5d4baa0f5a53818330941c1f0392938ac45e46ff64d8e7d9efb032acf598789fffb9f5a8108cc3975
6
+ metadata.gz: d68f0e28707f0cd4278ee03bc3b2d2a94ad810104ed03f9dc6e0ae4d5d6b524def6d17c5ed062b93eff83dd7fc72bd2d6d449c49e323f814a153507ea17b3745
7
+ data.tar.gz: a92ee03a0a4722df6b8dfc29b09edcf20b4730b53a2202e23cefbc5ea8a96917cbde2e1b9d50a2a84478602eaaa0e2b48a89b5778588e69cc9effef472a85054
data/bin/html2mail CHANGED
@@ -28,13 +28,14 @@ desc 'Sent email from html to given adress'
28
28
  arg 'files', multiple: true, desc: "HTML-files to process"
29
29
  command :send do |c|
30
30
  c.flag [:t, :to], default_value: nil
31
+ c.flag [:f, :from], default_value: Mailer2.smtp_settings[:user_name]
31
32
  c.flag [:s, :subj], default_value: nil
32
33
 
33
34
  c.action do |global_options, options, args|
34
35
  args.each do |f|
35
36
  STDERR.puts "Start mail processing"
36
37
 
37
- m= Mailer2.mail2 f, options[:to], options[:subj], global_options[:user]
38
+ m= Mailer2.mail2 f, options[:to], options[:subj], options[:from] || global_options[:smtp_user_name]
38
39
  m.deliver_now
39
40
 
40
41
  STDERR.puts "Done"
@@ -51,7 +52,7 @@ command :convert do |c|
51
52
 
52
53
  c.action do |global_options, options, args|
53
54
  args.each do |f|
54
- m = Mailer2.mail2 f, options[:to], options[:subj], global_options[:user]
55
+ m = Mailer2.mail2 f, options[:to], options[:subj], options[:from] || global_options[:smtp_user_name]
55
56
 
56
57
  html = m.to_s.html_safe
57
58
 
@@ -117,6 +118,7 @@ command :bulksend do |c|
117
118
  c.flag [:t, :timeout], default_value: 1.0, type: Float, desc: "Wait given seconds between sending mails"
118
119
  c.flag [:s, :subj], default_value: nil, desc: "Subject for mail. If blank then use <title> tag or html-file name"
119
120
  # c.flag [:p, :pretend], default_value: nil, desc: "Run but do not make any real actions"
121
+ c.flag [:f, :from], default_value: Mailer2.smtp_settings[:user_name]
120
122
 
121
123
  c.action do |global_options, options, args|
122
124
  file_type = File.extname(options[:list]).gsub('.', '').strip.downcase
@@ -134,7 +136,7 @@ command :bulksend do |c|
134
136
  rows.each_with_index do |row, index|
135
137
  args.each do |f|
136
138
  email = row[email_column]
137
- Mailer2.mail2(f, email, options[:subj], global_options[:user]).deliver_now
139
+ Mailer2.mail2(f, email, options[:subj], options[:from] || global_options[:smtp_user_name]).deliver_now
138
140
  STDERR.puts "(#{index+1}/#{total_count}) Email '#{File.basename(f)}' sent to #{email}"
139
141
  sleep(options[:timeout]) if options[:timeout].present?
140
142
  end
@@ -149,7 +151,7 @@ command :bulksend do |c|
149
151
  email = line.strip
150
152
  if email.present?
151
153
  args.each do |f|
152
- Mailer2.mail2(f, email, options[:subj], global_options[:user]).deliver_now
154
+ Mailer2.mail2(f, email, options[:subj], options[:from] || global_options[:smtp_user_name]).deliver_now
153
155
  # STDERR.print '.'
154
156
  STDERR.puts "(#{index+1}/#{total_count}) Email '#{File.basename(f)}' sent to #{email}"
155
157
 
@@ -3,7 +3,7 @@ require "action_mailer/base"
3
3
  require 'premailer'
4
4
 
5
5
  class Mailer2 < ActionMailer::Base
6
- def mail2(html_file, email, subject, from=nil)
6
+ def mail2(html_file, email, subject, from)
7
7
  premailer = Premailer.new(html_file, :warn_level => Premailer::Warnings::SAFE)
8
8
  doc = Nokogiri::HTML(premailer.to_inline_css)
9
9
 
@@ -23,7 +23,7 @@ class Mailer2 < ActionMailer::Base
23
23
 
24
24
  html = doc.to_s.html_safe
25
25
 
26
- from ||= email
26
+ # from ||= email
27
27
 
28
28
  mail from: from, to: email, subject: subject do |format|
29
29
  format.text { render plain: premailer.to_plain_text }
@@ -1,3 +1,3 @@
1
1
  module Html2mail
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html2mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Egor Vakhromtsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -175,3 +175,4 @@ signing_key:
175
175
  specification_version: 4
176
176
  summary: html to mail converter
177
177
  test_files: []
178
+ has_rdoc: