I am working on a Ruby on Rails 4.2.10 App with no views of the project structure. It is the backend logic in a Microservices architecture.
The problem I have here is the ActionMailer class is not getting inherited by the subclasses.
The emails were sent previously. Now, this same implementation is not working.
Does this have anything to do with the Rails version?
class ApplicationMailer < ActionMailer::Base
default from: "email@example.com"
class SampleMailer < ApplicationMailer
def xlsx_email(email, xlsx, filename)
mail.attachments[filename] = xlsx.read
body = "The report you requested is attached.\n\nThanks "
mail(from: "firstname.lastname@example.org", to: email, subject: "Report ", body:
The error I get is
NameError: undefined local variable or method 'mail' for SampleMailer:Class
When I tried using the mail and attachment method to call directly using ActionMailer::Base , it showed error
ActionView::MissingTemplate: Missing template sample_mailer/xlsx_email with "mailer". Searched in:* "sample_mailer"