courrier 0.9.0 → 0.11.0

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +16 -24
  4. data/README.md +178 -74
  5. data/courrier.gemspec +4 -4
  6. data/lib/courrier/configuration.rb +2 -4
  7. data/lib/courrier/email/provider.rb +14 -6
  8. data/lib/courrier/email/providers/base.rb +7 -2
  9. data/lib/courrier/email/providers/cloudflare.rb +35 -0
  10. data/lib/courrier/email/providers/lettermint.rb +31 -0
  11. data/lib/courrier/email/providers/loops.rb +1 -1
  12. data/lib/courrier/email/providers/mailgun.rb +1 -1
  13. data/lib/courrier/email/providers/mailjet.rb +1 -1
  14. data/lib/courrier/email/providers/mailpace.rb +1 -1
  15. data/lib/courrier/email/providers/postmark.rb +1 -1
  16. data/lib/courrier/email/providers/resend.rb +1 -1
  17. data/lib/courrier/email/providers/sendgrid.rb +1 -1
  18. data/lib/courrier/email/providers/ses.rb +75 -0
  19. data/lib/courrier/email/providers/smtp2go.rb +29 -0
  20. data/lib/courrier/email/providers/sparkpost.rb +1 -1
  21. data/lib/courrier/email/providers/userlist.rb +1 -1
  22. data/lib/courrier/email/request.rb +1 -1
  23. data/lib/courrier/email/transformer.rb +9 -9
  24. data/lib/courrier/email.rb +50 -38
  25. data/lib/courrier/errors.rb +0 -2
  26. data/lib/courrier/markdown.rb +52 -0
  27. data/lib/courrier/test.rb +38 -0
  28. data/lib/courrier/test_helper.rb +65 -0
  29. data/lib/courrier/version.rb +1 -1
  30. data/lib/courrier.rb +2 -2
  31. metadata +18 -31
  32. data/app/controllers/courrier/previews/cleanups_controller.rb +0 -13
  33. data/app/controllers/courrier/previews_controller.rb +0 -23
  34. data/app/views/courrier/previews/index.html.erb +0 -171
  35. data/config/routes.rb +0 -8
  36. data/lib/courrier/configuration/inbox.rb +0 -21
  37. data/lib/courrier/email/providers/inbox/default.html.erb +0 -126
  38. data/lib/courrier/email/providers/inbox.rb +0 -83
  39. data/lib/courrier/engine.rb +0 -7
  40. data/lib/courrier/jobs/email_delivery_job.rb +0 -23
  41. data/lib/courrier/railtie.rb +0 -23
  42. data/lib/courrier/tasks/courrier.rake +0 -13
  43. data/lib/generators/courrier/email_generator.rb +0 -42
  44. data/lib/generators/courrier/install_generator.rb +0 -11
  45. data/lib/generators/courrier/templates/email/password_reset.rb.tt +0 -29
  46. data/lib/generators/courrier/templates/email/welcome.rb.tt +0 -43
  47. data/lib/generators/courrier/templates/email.rb.tt +0 -15
  48. data/lib/generators/courrier/templates/initializer.rb.tt +0 -43
@@ -1,42 +0,0 @@
1
- module Courrier
2
- class EmailGenerator < Rails::Generators::NamedBase
3
- AVAILABLE_TEMPLATES = %w[welcome password_reset]
4
-
5
- desc "Create a new Courrier Email class"
6
-
7
- source_root File.expand_path("templates", __dir__)
8
-
9
- check_class_collision suffix: "Email"
10
-
11
- class_option :skip_suffix, type: :boolean, default: false
12
- class_option :template, type: :string, desc: "Template type (#{AVAILABLE_TEMPLATES.join(", ")})"
13
-
14
- def copy_mailer_file
15
- template template_file, destination_path
16
- end
17
-
18
- private
19
-
20
- def file_name = super.delete_suffix("_email")
21
-
22
- def parent_class = defined?(ApplicationEmail) ? ApplicationEmail : Courrier::Email
23
-
24
- def template_file
25
- if options[:template] && template_exists?("email/#{options[:template]}.rb.tt")
26
- "email/#{options[:template]}.rb.tt"
27
- else
28
- "email.rb.tt"
29
- end
30
- end
31
-
32
- def destination_path
33
- File.join(Courrier.configuration.email_path, class_path, "#{file_name}#{options[:skip_suffix] ? "" : "_email"}.rb")
34
- end
35
-
36
- def template_exists?(path)
37
- find_in_source_paths(path)
38
- rescue
39
- nil
40
- end
41
- end
42
- end
@@ -1,11 +0,0 @@
1
- module Courrier
2
- class InstallGenerator < Rails::Generators::Base
3
- desc "Creates the initializer for Courrier"
4
-
5
- source_root File.expand_path("templates", __dir__)
6
-
7
- def copy_initializer_file
8
- template "initializer.rb", "config/initializers/courrier.rb"
9
- end
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- # Usage:
2
- #
3
- # PasswordResetEmail.deliver to: user.email, reset_url: edit_password_url(user.password_reset_token)
4
- #
5
- class <%= class_name %><%= options[:skip_suffix] ? "" : "Email" %> < <%= parent_class %>
6
- def subject = "Reset your password"
7
-
8
- def text
9
- <<~TEXT
10
- You can reset your password within the next 15 minutes on this password reset page:
11
- #{reset_url}
12
-
13
- If you didn't request a password reset, please ignore this email.
14
- TEXT
15
- end
16
-
17
- def html
18
- <<~HTML
19
- <p>
20
- You can reset your password within the next 15 minutes on
21
- <a href="#{reset_url}">this password reset page</a>.
22
- </p>
23
-
24
- <p>
25
- If you didn't request a password reset, please ignore this email.
26
- </p>
27
- HTML
28
- end
29
- end
@@ -1,43 +0,0 @@
1
- # Usage:
2
- #
3
- # WelcomeEmail.deliver to: user.email, name: "John", login_url: "https://example.com/login"
4
- #
5
- class <%= class_name %><%= options[:skip_suffix] ? "" : "Email" %> < <%= parent_class %>
6
- def subject = "Welcome to My First App, #{name}!"
7
-
8
- def text
9
- <<~TEXT
10
- Welcome, #{name}!
11
-
12
- We're excited to have you on board. Here's how to get started:
13
-
14
- 1. Log in to your account: #{login_url}
15
- 2. Complete your profile
16
- 3. Explore our features
17
-
18
- If you have any questions, our help center is available to assist you.
19
-
20
- Thanks for joining us!
21
- TEXT
22
- end
23
-
24
- def html
25
- <<~HTML
26
- <p>Welcome, #{name}!</p>
27
-
28
- <p>We're excited to have you on board. Here's how to get started:</p>
29
-
30
- <ol>
31
- <li><a href="#{login_url}">Log in to your account</a></li>
32
- <li>Complete your profile</li>
33
- <li>Explore our features</li>
34
- </ol>
35
-
36
- <p>If you have any questions, our help center is available to assist you.</p>
37
-
38
- <p>
39
- Thanks for joining us!
40
- </p>
41
- HTML
42
- end
43
- end
@@ -1,15 +0,0 @@
1
- class <%= class_name %><%= options[:skip_suffix] ? "" : "Email" %> < <%= parent_class %>
2
- def subject = ""
3
-
4
- # Create HTML and text emails using:
5
- # https://railsdesigner.com/minimal-email-editor/
6
- def text
7
- <<~TEXT
8
- TEXT
9
- end
10
-
11
- def html
12
- <<~HTML
13
- HTML
14
- end
15
- end
@@ -1,43 +0,0 @@
1
- Courrier.configure do |config|
2
- include Courrier::Email::Address
3
-
4
- # Set your email delivery provider
5
- # config.email = {
6
- # provider: "", # default, `logger`, choose from: <%= Courrier::Email::Provider::PROVIDERS.keys.join(", ") %>
7
- # api_key: "" your transactional email provider's API key
8
- # }
9
-
10
- # Set your marketing email provider
11
- # config.subscriber = {
12
- # provider: ""
13
- # }
14
-
15
-
16
- # Configure provider-specific settings
17
- # config.providers.loops.transactional_id = ""
18
- # config.providers.mailgun.domain = ""
19
-
20
-
21
- # Set default sender details
22
- config.from = email_with_name("support@example.com", "Example Support") # => `Example Support <support@example.com>`
23
- # config.reply_to = ""
24
- # config.cc = ""
25
- # config.bcc = ""
26
-
27
-
28
- # Set host for Rails URL helpers, e.g. `{host: "https://railsdesigner.com/"}`
29
- # config.default_url_options = {}
30
-
31
- # Generate text version from HTML content
32
- # Default: `false`
33
- # config.auto_generate_text = false
34
-
35
- # Location for generated Courrier Emails
36
- # Default: `app/emails`
37
- # config.email_path = ""
38
-
39
-
40
- # Select logger for the `logger` provider
41
- # Default: `::Logger.new($stdout)` - Ruby's built-in Logger
42
- # config.logger = ""
43
- end