Skip to main content

SMTP From address may not be blank: nil rails action mailer

This error because of the default hash in action mailer. Default hash is from address to mailers.

for below mailer it don't have any default mail address. But my case, i created a application mailer is inheriting from ActionMailer::Base.

class ApplicationMailer < ActionMailer::Base
  default from: "xxxxxxxxx@gmail.com"
  layout 'mailer'
end



class PostCreate < ActionMailer::Base
   
    def user_post(user)
        @user = user
        @post = @user.posts.last
       
        mail to: @user.email, subject: "Your post created #{@post.title}"
       
    end
end


Two ways solve this kind of errors:
  1. Above case replace ActionMailer::Base from the PostCreate to ApplicationMailer
  2. Add default mailer hash to PostCreate file.

Comments

Popular posts from this blog

How to add domain in digital ocean

Add domain to digital ocean website. Register a domain in Godaddy. This video tells you how to add the domain to your static website in digital ocean.

Real estate datasets

Our real estate datasets offer structured data from leading global property platforms like Trulia, Zoopla, and Redfin. These datasets include vital fields such as listing details, pricing, sales history, location metadata, community stats, agent info, and more — all ready to power your AI models, dashboards, and research. Who Uses These Datasets? 🏢 Real estate investors and hedge funds 🏗 Construction and infrastructure companies 📊 Real estate data analysts and researchers 🏘 Urban development planners and policy teams 💡 AI/ML teams building real estate intelligence solutions 🗂 Real Estate Datasets Available: Trulia Real-Estate Property Listings Dataset – 1.47 million records (JSON) Zoopla UK Real Estate Dataset – 100K records (CSV) Redfin Canada Properties Dataset – 110K records (CSV) Redfin USA Properties Data – 1 million records (CSV) Redfin Real Estate Data – 250K records (CSV) 🔍 Browse all real estate datasets →