rails-mailpack 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +103 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/html_links_to_text_interceptor.rb +55 -0
- data/lib/rails/mailpack.rb +12 -0
- data/lib/rails/mailpack/all.rb +9 -0
- data/lib/rails/mailpack/version.rb +5 -0
- data/lib/templates/layouts/application_mailer.html.erb +109 -0
- data/lib/templates/layouts/application_mailer.text.erb +5 -0
- data/lib/templates/stylesheets/application_mailer.sass +194 -0
- data/rails-mailpack.gemspec +32 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c848e3212f8e46d80a4f2b2de34164eb54d7d1e7
|
4
|
+
data.tar.gz: 27212cf8ceea92cf88be2c17e850ebbfa9245c1a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 20b8d973e7c5eed0094c3246ebf8b8ca846c704eddac19749e73e53e87695dfa5a212c7b3232a0840b613b112b3179bf49bae8e87bbf72fb05910fc7e6e3477f
|
7
|
+
data.tar.gz: f9c38a6be4e476af21c65135e45baf8fb5087f0edc79b5e85324058e7405a4ba7824c3f5197837817bdc672e532fa3dfe0fd7617acdf98a9a91da4e840f0540d
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at jakob@mentalized.net. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Substance Lab
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Jakob Skjerning
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# Mailpack
|
2
|
+
## Send simple, maintainable, and compatible emails in Rails
|
3
|
+
|
4
|
+
Rails makes sending out multipart emails deceptively easy. Just throw two appropriately named templates in your mailers view-directory, and ActionMailer takes care of everything for you.
|
5
|
+
|
6
|
+
But email is never as easy it seems. These are a few battle-tested tricks we have learned that makes emails manageable.
|
7
|
+
|
8
|
+
## With Mailpack you get to
|
9
|
+
|
10
|
+
* Write emails in Markdown
|
11
|
+
* Use layouts for emails
|
12
|
+
* Include images in your emails without worry
|
13
|
+
* Use Sass and CSS to style emails
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
To build both plain text and HTML versions of your email:
|
18
|
+
|
19
|
+
class HelloMailer < ApplicationMailer
|
20
|
+
def greeting
|
21
|
+
@name = "Bob"
|
22
|
+
mail(:to => "noone@example.com") do |format|
|
23
|
+
format.text
|
24
|
+
format.html
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
The template supports Markdown and ERB:
|
30
|
+
|
31
|
+
# Hi <%= @name %>
|
32
|
+
|
33
|
+
* This is a list
|
34
|
+
* ... with multiple items
|
35
|
+
|
36
|
+
We've included two sample layout files; one for HTML mails and one for plain text. They're in `lib/templates/application_mailer.*.erb`.
|
37
|
+
|
38
|
+
They support the following content blocks:
|
39
|
+
|
40
|
+
* `call_to_action`: Use this to output a big button with a link below the primary content of the email.
|
41
|
+
* `below_call_to_action`: Use this to insert extra content below the call to action. Usually less important stuff, like legal rambles or explanations of the preceding content.
|
42
|
+
|
43
|
+
To style your email create an `app/assets/stylesheets/application_mailer.sass` (or however you prefer styling). Include the file into your email HTML layout:
|
44
|
+
|
45
|
+
<%= stylesheet_link_tag "application_mailer" %>
|
46
|
+
|
47
|
+
This causes the styles from the stylesheet to be inserted as inline styles in the rendered email.
|
48
|
+
|
49
|
+
We've included a sample stylesheet in `lib/templates/application_mailer.sass`, based on tested and hardened styles built by [Litmus](https://litmus.com/resources/free-responsive-email-templates).
|
50
|
+
|
51
|
+
## What's included in the box
|
52
|
+
|
53
|
+
Mailpack stands on the shoulders of giants:
|
54
|
+
|
55
|
+
* [premailer](https://github.com/premailer/premailer) via [premailer-rails](https://github.com/fphilipe/premailer-rails)
|
56
|
+
* [Markerb](https://github.com/plataformatec/markerb)
|
57
|
+
|
58
|
+
### Markerb
|
59
|
+
|
60
|
+
> Markerb allows you to render multipart e-mails from a single template. The template is written in Markdown, which is delivered as a text part, but also rendered and delivered as an HTML part.
|
61
|
+
|
62
|
+
### Premailer
|
63
|
+
|
64
|
+
* CSS styles are converted to inline style attributes
|
65
|
+
* Relative paths are converted to absolute paths
|
66
|
+
* CSS properties are checked against e-mail client capabilities
|
67
|
+
* A plain text version is created (optional)
|
68
|
+
|
69
|
+
## Installation
|
70
|
+
|
71
|
+
Add this line to your application's Gemfile:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
gem "rails-mailpack", :require => false
|
75
|
+
```
|
76
|
+
|
77
|
+
And then execute:
|
78
|
+
|
79
|
+
$ bundle
|
80
|
+
|
81
|
+
Or install it yourself as:
|
82
|
+
|
83
|
+
$ gem install rails-mailpack
|
84
|
+
|
85
|
+
### To convert HTML links to a pretty text version
|
86
|
+
|
87
|
+
Add an initializer:
|
88
|
+
|
89
|
+
require "rails/mailpack/all"
|
90
|
+
|
91
|
+
## Development
|
92
|
+
|
93
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
94
|
+
|
95
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
1. Fork it ( https://github.com/substancelab/rails-mailpack/fork )
|
100
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
101
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
102
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
103
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rails/mailpack"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "loofah"
|
4
|
+
require "mail"
|
5
|
+
|
6
|
+
# An ActionMailer interceptor that converts HTML links to a text-representation
|
7
|
+
# in the text/plain part of emails.
|
8
|
+
class HtmlLinksToTextInterceptor
|
9
|
+
# A specialized Scrubber to convert HTML links to text
|
10
|
+
class LinkScrubber < Loofah::Scrubber
|
11
|
+
def scrub(node)
|
12
|
+
replace_link_node_with_text_node(node) if link?(node)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def build_text_node_from_link(node)
|
18
|
+
link_text_node = node.children.first
|
19
|
+
link_text_node.content = "#{link_text_node}: #{extract_url(node)}"
|
20
|
+
link_text_node
|
21
|
+
end
|
22
|
+
|
23
|
+
def extract_url(node)
|
24
|
+
href = node.attributes["href"]
|
25
|
+
return nil unless href
|
26
|
+
href.value
|
27
|
+
end
|
28
|
+
|
29
|
+
def link?(node)
|
30
|
+
node.name == "a"
|
31
|
+
end
|
32
|
+
|
33
|
+
def replace_link_node_with_text_node(node)
|
34
|
+
link_as_text = build_text_node_from_link(node)
|
35
|
+
node.before link_as_text
|
36
|
+
node.remove
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.delivering_email(message)
|
41
|
+
return message unless message.text_part
|
42
|
+
|
43
|
+
text_body = message.text_part.body
|
44
|
+
message.text_part.body = scrub_body(text_body).to_s
|
45
|
+
message
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.previewing_email(message)
|
49
|
+
delivering_email(message)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.scrub_body(body)
|
53
|
+
Loofah.fragment(body.to_s).scrub!(LinkScrubber.new)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "html_links_to_text_interceptor"
|
4
|
+
require "markerb"
|
5
|
+
require "premailer/rails"
|
6
|
+
|
7
|
+
# Convert html links to text links
|
8
|
+
ActionMailer::Base.register_interceptor HtmlLinksToTextInterceptor
|
9
|
+
ActionMailer::Base.register_preview_interceptor HtmlLinksToTextInterceptor
|
@@ -0,0 +1,109 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>Rails::Mailpack</title>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
8
|
+
<%= stylesheet_link_tag "application_mailer" %>
|
9
|
+
</head>
|
10
|
+
<body style="margin: 0; padding: 0;">
|
11
|
+
|
12
|
+
<%# HEADER %>
|
13
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
14
|
+
<tr>
|
15
|
+
<td bgcolor="#ffffff" align="center">
|
16
|
+
<%# HIDDEN PREHEADER TEXT %>
|
17
|
+
<%- if content_for?(:preheader_text) -%>
|
18
|
+
<div class="preheader-text">
|
19
|
+
<%= content_for :preheader_text -%>
|
20
|
+
</div>
|
21
|
+
<%- end -%>
|
22
|
+
<table border="0" cellpadding="0" cellspacing="0" width="500" class="wrapper">
|
23
|
+
<%# LOGO/PREHEADER TEXT %>
|
24
|
+
<tr>
|
25
|
+
<td class="logo" align="center">
|
26
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
27
|
+
<tr>
|
28
|
+
<td bgcolor="#ffffff" width="100" align="center"><%= image_tag("logo.png", :alt => "Your logo from the asset pipeline", :width => "32", :height => "32", :style => "display: block;", :border => "0") %></td>
|
29
|
+
</tr>
|
30
|
+
</table>
|
31
|
+
</td>
|
32
|
+
</tr>
|
33
|
+
</table>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
</table>
|
37
|
+
|
38
|
+
<%# ONE COLUMN SECTION %>
|
39
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
40
|
+
<tr>
|
41
|
+
<td bgcolor="#ffffff" align="center" class="section-padding">
|
42
|
+
<table border="0" cellpadding="0" cellspacing="0" width="500" class="responsive-table">
|
43
|
+
<tr>
|
44
|
+
<td>
|
45
|
+
<%= yield %>
|
46
|
+
</td>
|
47
|
+
</tr>
|
48
|
+
<%- if content_for?(:call_to_action) -%>
|
49
|
+
<tr>
|
50
|
+
<td align="center">
|
51
|
+
<%# CALL TO ACTION %>
|
52
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mobile-button-container">
|
53
|
+
<tr>
|
54
|
+
<td align="center" class="call-to-action padding-copy">
|
55
|
+
<table border="0" cellspacing="0" cellpadding="0" class="responsive-table">
|
56
|
+
<tr>
|
57
|
+
<td align="center"><%= content_for(:call_to_action) %></td>
|
58
|
+
</tr>
|
59
|
+
</table>
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
</table>
|
63
|
+
</td>
|
64
|
+
</tr>
|
65
|
+
<%- end -%>
|
66
|
+
<%- if content_for?(:below_call_to_action) -%>
|
67
|
+
<tr>
|
68
|
+
<td>
|
69
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
70
|
+
<tr>
|
71
|
+
<td>
|
72
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
73
|
+
<tr>
|
74
|
+
<td align="left" class="note padding-copy"><%= content_for(:below_call_to_action) %></td>
|
75
|
+
</tr>
|
76
|
+
</table>
|
77
|
+
</td>
|
78
|
+
</tr>
|
79
|
+
</table>
|
80
|
+
</td>
|
81
|
+
</tr>
|
82
|
+
<%- end -%>
|
83
|
+
</table>
|
84
|
+
</td>
|
85
|
+
</tr>
|
86
|
+
</table>
|
87
|
+
|
88
|
+
<%# FOOTER %>
|
89
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
90
|
+
<tr>
|
91
|
+
<td bgcolor="#ffffff" align="center">
|
92
|
+
<table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
|
93
|
+
<tr>
|
94
|
+
<td class="footer-padding" align="center">
|
95
|
+
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table">
|
96
|
+
<tr>
|
97
|
+
<td align="center" class="footer-copy">
|
98
|
+
<span class="appleFooter" style="color:#666666;">Footer content goes here, perhaps unsubscribe information?</span>
|
99
|
+
</td>
|
100
|
+
</tr>
|
101
|
+
</table>
|
102
|
+
</td>
|
103
|
+
</tr>
|
104
|
+
</table>
|
105
|
+
</td>
|
106
|
+
</tr>
|
107
|
+
</table>
|
108
|
+
</body>
|
109
|
+
</html>
|
@@ -0,0 +1,194 @@
|
|
1
|
+
// This stylesheet is embedded into all our HTML emails. In addition, its styles
|
2
|
+
// are placed inline in each HTML email as necessary to work around email
|
3
|
+
// clients being stupid.
|
4
|
+
//
|
5
|
+
// Based on Slate by Litmus
|
6
|
+
// https://litmus.com/resources/free-responsive-email-templates
|
7
|
+
|
8
|
+
$meta-data-color: #666666
|
9
|
+
$primary-action-color: #4488CC
|
10
|
+
|
11
|
+
// CLIENT-SPECIFIC STYLES
|
12
|
+
|
13
|
+
// Force Outlook to provide a "view in browser" message
|
14
|
+
#outlook a
|
15
|
+
padding: 0
|
16
|
+
|
17
|
+
// Force Hotmail to display emails at full width
|
18
|
+
.ReadMsgBody
|
19
|
+
width: 100%
|
20
|
+
.ExternalClass
|
21
|
+
width: 100%
|
22
|
+
line-height: 100%
|
23
|
+
|
24
|
+
// Force Hotmail to display normal line spacing
|
25
|
+
p, span, font, td, div
|
26
|
+
line-height: 100%
|
27
|
+
|
28
|
+
// Prevent WebKit and Windows mobile changing default text sizes
|
29
|
+
body, table, td, a
|
30
|
+
-webkit-text-size-adjust: 100%
|
31
|
+
-ms-text-size-adjust: 100%
|
32
|
+
|
33
|
+
// Remove spacing between tables in Outlook 2007 and up
|
34
|
+
table, td
|
35
|
+
mso-table-lspace: 0pt
|
36
|
+
mso-table-rspace: 0pt
|
37
|
+
|
38
|
+
// Allow smoother rendering of resized image in Internet Explorer
|
39
|
+
img
|
40
|
+
-ms-interpolation-mode: bicubic
|
41
|
+
|
42
|
+
|
43
|
+
// RESET STYLES
|
44
|
+
|
45
|
+
body
|
46
|
+
margin: 0
|
47
|
+
padding: 0
|
48
|
+
|
49
|
+
img
|
50
|
+
border: 0
|
51
|
+
height: auto
|
52
|
+
line-height: 100%
|
53
|
+
outline: none
|
54
|
+
text-decoration: none
|
55
|
+
|
56
|
+
table
|
57
|
+
border-collapse: collapse !important
|
58
|
+
|
59
|
+
body
|
60
|
+
height: 100% !important
|
61
|
+
margin: 0
|
62
|
+
padding: 0
|
63
|
+
width: 100% !important
|
64
|
+
|
65
|
+
// iOS BLUE LINKS
|
66
|
+
.appleBody a
|
67
|
+
color: #68440a
|
68
|
+
text-decoration: none
|
69
|
+
.appleFooter a
|
70
|
+
color: #999999
|
71
|
+
text-decoration: none
|
72
|
+
|
73
|
+
.note
|
74
|
+
color: $meta-data-color
|
75
|
+
font:
|
76
|
+
size: 14px
|
77
|
+
style: italic
|
78
|
+
line-height: 18px
|
79
|
+
padding: 0 0 0 0
|
80
|
+
|
81
|
+
.mobile-button
|
82
|
+
background-color: $primary-action-color
|
83
|
+
border:
|
84
|
+
bottom: 15px solid $primary-action-color
|
85
|
+
left: 25px solid $primary-action-color
|
86
|
+
right: 25px solid $primary-action-color
|
87
|
+
top: 15px solid $primary-action-color
|
88
|
+
border-radius: 3px
|
89
|
+
-moz-border-radius: 3px
|
90
|
+
-webkit-border-radius: 3px
|
91
|
+
color: #ffffff
|
92
|
+
display: inline-block
|
93
|
+
font:
|
94
|
+
family: Helvetica, Arial, sans-serif
|
95
|
+
size: 16px
|
96
|
+
weight: normal
|
97
|
+
text-decoration: none
|
98
|
+
|
99
|
+
.preheader-text
|
100
|
+
color: #fefefe
|
101
|
+
display: none
|
102
|
+
font:
|
103
|
+
family: Helvetica, Arial, sans-serif
|
104
|
+
size: 1px
|
105
|
+
line-height: 1px
|
106
|
+
max-height: 0px
|
107
|
+
max-width: 0px
|
108
|
+
opacity: 0
|
109
|
+
overflow: hidden
|
110
|
+
|
111
|
+
td
|
112
|
+
color: $body-text-color
|
113
|
+
font:
|
114
|
+
family: Helvetica, Arial, sans-serif
|
115
|
+
size: 16px
|
116
|
+
line-height: 25px
|
117
|
+
|
118
|
+
&.call-to-action
|
119
|
+
padding: 25px
|
120
|
+
|
121
|
+
&.footer-copy
|
122
|
+
font-size: 12px
|
123
|
+
line-height: 18px
|
124
|
+
|
125
|
+
&.footer-padding
|
126
|
+
padding: 70px 0px 20px 0px
|
127
|
+
|
128
|
+
&.logo
|
129
|
+
padding: 20px 0px 30px 0px
|
130
|
+
|
131
|
+
&.section-padding
|
132
|
+
padding: 15px 15px 15px 15px
|
133
|
+
|
134
|
+
// MOBILE STYLES
|
135
|
+
@media screen and (max-width: 525px)
|
136
|
+
// Allows for fluid tables
|
137
|
+
table[class="wrapper"]
|
138
|
+
width: 100% !important
|
139
|
+
|
140
|
+
// Adjusts layout of logo image
|
141
|
+
td
|
142
|
+
&[class="logo"]
|
143
|
+
padding: 20px 0 20px 0 !important
|
144
|
+
text-align: left
|
145
|
+
|
146
|
+
img
|
147
|
+
margin: 0 auto !important
|
148
|
+
|
149
|
+
&[class="mobile-hide"]
|
150
|
+
display: none
|
151
|
+
|
152
|
+
// Use these classes to hide content on mobile
|
153
|
+
img
|
154
|
+
&[class="mobile-hide"]
|
155
|
+
display: none !important
|
156
|
+
|
157
|
+
&[class="img-max"]
|
158
|
+
height: auto !important
|
159
|
+
max-width: 100% !important
|
160
|
+
|
161
|
+
// Full-width tables
|
162
|
+
table[class="responsive-table"]
|
163
|
+
width: 100% !important
|
164
|
+
|
165
|
+
// Utility classes for adjusting padding on mobile
|
166
|
+
td
|
167
|
+
&[class="padding"]
|
168
|
+
padding: 10px 5% 15px 5% !important
|
169
|
+
&[class="padding-copy"]
|
170
|
+
padding: 10px 5% 10px 5% !important
|
171
|
+
text-align: left !important
|
172
|
+
&[class="padding-meta"]
|
173
|
+
padding: 30px 5% 0px 5% !important
|
174
|
+
text-align: center
|
175
|
+
&[class="no-pad"]
|
176
|
+
padding: 0 0 20px 0 !important
|
177
|
+
&[class="no-padding"]
|
178
|
+
padding: 0 !important
|
179
|
+
&[class="section-padding"]
|
180
|
+
padding: 10px 15px 10px 15px !important
|
181
|
+
&[class="section-padding-bottom-image"]
|
182
|
+
padding: 50px 15px 0 15px !important
|
183
|
+
&[class="mobile-wrapper"]
|
184
|
+
padding: 10px 5% 15px 5% !important
|
185
|
+
|
186
|
+
// Adjust buttons on mobile
|
187
|
+
table[class="mobile-button-container"]
|
188
|
+
margin: 0 auto
|
189
|
+
width: 100% !important
|
190
|
+
a[class="mobile-button"]
|
191
|
+
border: 0 !important
|
192
|
+
font-size: 16px !important
|
193
|
+
padding: 15px !important
|
194
|
+
width: 90% !important
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails/mailpack/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rails-mailpack"
|
8
|
+
spec.version = Rails::Mailpack::VERSION
|
9
|
+
spec.authors = ["Jakob Skjerning"]
|
10
|
+
spec.email = ["jakob@mentalized.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{A few battle-tested tricks to make Rails emails manageable}
|
13
|
+
spec.description = %q{Rails makes emails easy, but email is never as easy it seems. These are a few battle-tested tricks we have learned that makes emails manageable}
|
14
|
+
spec.homepage = "https://github.com/substancelab/rails-mailpack"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "kramdown"
|
23
|
+
spec.add_dependency "loofah"
|
24
|
+
spec.add_dependency "markerb"
|
25
|
+
spec.add_dependency "mail"
|
26
|
+
spec.add_dependency "nokogiri"
|
27
|
+
spec.add_dependency "premailer-rails"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "minitest"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-mailpack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jakob Skjerning
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: kramdown
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: loofah
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: markerb
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mail
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: premailer-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.12'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '10.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '10.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: minitest
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Rails makes emails easy, but email is never as easy it seems. These are
|
140
|
+
a few battle-tested tricks we have learned that makes emails manageable
|
141
|
+
email:
|
142
|
+
- jakob@mentalized.net
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- CODE_OF_CONDUCT.md
|
149
|
+
- Gemfile
|
150
|
+
- LICENSE
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- bin/console
|
155
|
+
- bin/setup
|
156
|
+
- lib/html_links_to_text_interceptor.rb
|
157
|
+
- lib/rails/mailpack.rb
|
158
|
+
- lib/rails/mailpack/all.rb
|
159
|
+
- lib/rails/mailpack/version.rb
|
160
|
+
- lib/templates/layouts/application_mailer.html.erb
|
161
|
+
- lib/templates/layouts/application_mailer.text.erb
|
162
|
+
- lib/templates/stylesheets/application_mailer.sass
|
163
|
+
- rails-mailpack.gemspec
|
164
|
+
homepage: https://github.com/substancelab/rails-mailpack
|
165
|
+
licenses:
|
166
|
+
- MIT
|
167
|
+
metadata: {}
|
168
|
+
post_install_message:
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
requirements: []
|
183
|
+
rubyforge_project:
|
184
|
+
rubygems_version: 2.6.3
|
185
|
+
signing_key:
|
186
|
+
specification_version: 4
|
187
|
+
summary: A few battle-tested tricks to make Rails emails manageable
|
188
|
+
test_files: []
|