Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8030741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:52:02+00:00 2026-06-05T00:52:02+00:00

I am trying to send an email to the event administrator, after the user

  • 0

I am trying to send an email to the event administrator, after the user confirms.

See: Rails: Devise: Sending an email after user comfirms registration

I wrote an EventMailer class as follows:

class EventMailer < ActionMailer::Base
  @user = User

  @host_name = "localhost:3000" if Rails.env.development?
  @host_name = "test.com" if Rails.env.test?
  @host_name = "production.com" if Rails.env.production?

 def self.send_email_to_admin
   @@smtp_settings = { #override default smtp settings since I'm using a difference sender
     :address => "smtp.gmail.com",
     :port => 587,
     :domain => @host_name,

     :authentication => "plain",
     :enable_starttls_auto_=> true,
     :user_name => ENV["ORG_FROM"],
     :password => ENV["ORG_FROM_PWD"],
     :to => ADMIN_RECIPIENTS
     #ADMIN_RECIPIENTS is defined elsewhere
   }
   mail(:subject => "Invite request received from " + @user.first.to_s + " " + @user.last.to_s)
 end
end

When users register, they receive a registration link. When they click on that link, they get the following error message:

undefined method `mail' for EventMailer:Class

app/mailers/event_mailer.rb:20:in `send_email_to_admin'
app/controllers/confirmations_controller.rb:11:in `show'

Any ideas?

EDIT:

The solution is to move both the :to and :from inside the mail nethod

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:52:04+00:00Added an answer on June 5, 2026 at 12:52 am

    Try moving :to => DENT_ADMIN_RECIPIENTS into the mail method:

    mail(:to => DENT_ADMIN_RECIPIENTS, :subject => "Invite request received from " + @user.first.to_s + " " + @user.last.to_s)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send an email in the button click event in the
I am trying to send email using gmail from my mvc application. I am
I am trying to send email using AJAX and PHP but no success:( My
I am trying to send email using PHP. The email is an HTML email
I am trying to send email using Exchange 2007 from a console app using
I'm trying to send email with some images attached in django. Code used is
I am trying to send email using smtp authentication through google but I am
I am trying to send email using c# following is my code. try {
Trying to send some email in my C# app. I am behind a proxy
I am trying to send an email to customers with html form. here is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.