rake_mailer 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/rake_mailer/mail_it.rb +12 -0
- data/lib/rake_mailer/version.rb +1 -1
- data/lib/rake_mailer.rb +3 -3
- metadata +3 -4
- data/app/mailers/mail_it.rb +0 -10
- data/app/views/mail_it/custom_text_email.html.erb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 149563cb9400493f2b7023aebf79269b7e8c007b
|
4
|
+
data.tar.gz: 2c232f85bb34976a80f517e9eb2a908343c41075
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37faf0deabd82821ca35b7b5908a4f64a6878246068413d9623a3b071ecca4988a3cbcb9ccd378a066609f25afda29f2db53297033089ab74524542d38543ab
|
7
|
+
data.tar.gz: dac5f0ecf9a1239649fb8f39b4522a10ed71ae8a01051a673c10ff6989a05b0cd7944f802b94004ebe26415e5a5381f6db3919edd5d4a4dcf201e775f0548363
|
data/README.md
CHANGED
@@ -40,6 +40,21 @@ Or install it yourself as:
|
|
40
40
|
r.close
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
### Action Mailer Setting:
|
45
|
+
Add code like below to your application.rb file:
|
46
|
+
config.action_mailer.delivery_method = :smtp
|
47
|
+
config.action_mailer.smtp_settings = {
|
48
|
+
address: 'smtp.gmail.com',
|
49
|
+
port: 587,
|
50
|
+
domain: 'example.com',
|
51
|
+
user_name: '<username>',
|
52
|
+
password: '<password>',
|
53
|
+
authentication: 'plain',
|
54
|
+
enable_starttls_auto: true }
|
55
|
+
|
56
|
+
For more details visit: http://guides.rubyonrails.org/action_mailer_basics.html
|
57
|
+
|
43
58
|
```
|
44
59
|
This will create a file 1465113400_bug_fixes:test.txt and mail it as an attachment.
|
45
60
|
Email settings will be used from rake_mailer.yml
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module RakeMailer
|
2
|
+
class MailIt < ActionMailer::Base
|
3
|
+
def custom_text_email(from, to, file_location, filename, subject)
|
4
|
+
attachments[filename] = File.read(file_location)
|
5
|
+
mail :from => from,
|
6
|
+
:to => to,
|
7
|
+
:subject => subject do |format|
|
8
|
+
format.text { render text: 'PFA' }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/rake_mailer/version.rb
CHANGED
data/lib/rake_mailer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rake_mailer/version"
|
2
2
|
require 'rubygems'
|
3
3
|
require 'action_mailer'
|
4
|
-
require
|
4
|
+
require "rake_mailer/mail_it"
|
5
5
|
require 'fileutils'
|
6
6
|
|
7
7
|
module RakeMailer
|
@@ -10,7 +10,7 @@ module RakeMailer
|
|
10
10
|
@rake_mailer_constants = YAML.load_file("#{Rails.root}/config/rake_mailer.yml")[Rails.env]
|
11
11
|
@from = @rake_mailer_constants['from']
|
12
12
|
@emails = emails || @rake_mailer_constants['emails']
|
13
|
-
@subject = "Rake Mailer
|
13
|
+
@subject = "[Rake Mailer] Report for #{Rake.application.top_level_tasks.first}"
|
14
14
|
config_file_path = @rake_mailer_constants['file_path']
|
15
15
|
if (config_file_path.nil? || (config_file_path.is_a? String))
|
16
16
|
@filename = Time.now.to_i.to_s + "_#{Rake.application.top_level_tasks.first}" + '.txt'
|
@@ -35,7 +35,7 @@ module RakeMailer
|
|
35
35
|
private
|
36
36
|
def send_email
|
37
37
|
if @from.present? && @emails.present? && ((@from.is_a? String) || (@from.is_a? Array)) && ((@emails.is_a? String) || (@emails.is_a? Array))
|
38
|
-
MailIt.custom_text_email(@from, @emails, @file_location, @filename, @subject).deliver_now
|
38
|
+
RakeMailer::MailIt.custom_text_email(@from, @emails, @file_location, @filename, @subject).deliver_now
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gemin Patel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,11 +124,10 @@ files:
|
|
124
124
|
- LICENSE.txt
|
125
125
|
- README.md
|
126
126
|
- Rakefile
|
127
|
-
- app/mailers/mail_it.rb
|
128
|
-
- app/views/mail_it/custom_text_email.html.erb
|
129
127
|
- bin/console
|
130
128
|
- bin/setup
|
131
129
|
- lib/rake_mailer.rb
|
130
|
+
- lib/rake_mailer/mail_it.rb
|
132
131
|
- lib/rake_mailer/version.rb
|
133
132
|
- rake_mailer.gemspec
|
134
133
|
homepage: http://geminpatel.github.io/rake_mailer/
|
data/app/mailers/mail_it.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
class MailIt < ActionMailer::Base
|
2
|
-
def custom_text_email(from, to, file_location, filename, subject)
|
3
|
-
attachments[filename] = File.read(file_location)
|
4
|
-
mail :from => from,
|
5
|
-
:to => to,
|
6
|
-
:subject => subject do |format|
|
7
|
-
format.text { render text: 'PFA' }
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
File without changes
|