sighmon / mjml-rails

MJML + ERb/Haml/Slim view template
https://mjml.io
Other
295 stars 64 forks source link

Fix name of the example email template #80

Closed anatoliyarkhipov closed 2 years ago

anatoliyarkhipov commented 3 years ago

It's not so about the name itself (which isn't hard to guess is incorrect), as about the .html.mjml extension - I realized that .html should be removed only after reading the post linked below in the README. Until then I was receiving image

sighmon commented 2 years ago

@anatoliyarkhipov Sorry for the long delay in replying.

What did your mail look like? I think if you were requesting format.mjml then the file would need to be .mjml, but if you request format.html then the file can be called .html.mjml.

So perhaps this PR should change format.mjml to format.html?

# ./app/mailers/user_mailer.rb
class UserMailer < ActionMailer::Base
  def user_signup_confirmation
    mail(to: "user@example.com", from: "app@example.com") do |format|
      format.text
      format.html
    end
  end
end
anatoliyarkhipov commented 2 years ago

Hellooow. You're right.

This is my mailer:

class PonyMailer < ApplicationMailer
  def doggo_report(hooman)
    subject = "A report from Doggo"
    mail to: hooman.email, subject: subject do |format|
      format.mjml
    end
  end
end

But also, it's suggested to use .mjml in the README: image

sighmon commented 2 years ago

@anatoliyarkhipov I went with your suggestion and updated the partial code in the example. Thanks for your PR.

anatoliyarkhipov commented 2 years ago

Thank you @sighmon, for making the library, it's a beautiful piece of software.