Boss Nass
Boss Nass

Reputation: 3522

RoR Mailer issues

im attempting to send an email to the active user when an event is created. though when doing so i am getting the following error

Started POST "/events" for 124.149.85.178 at Sat Jul 07 13:15:03 +0200 2012
Processing by SchedulesController#create as HTML
  Parameters: {"utf8"=>"✓", "time"=>{"typedatetimeclassrequired"=>""}, "authenticity_token"=>"TntGzQ/plgGWKh66F74sDwUXCJVKrv0tYSfaOlUMiFE=", "schedule"=>{"user_id"=>[""], "event"=>"1", "team_id"=>"", "arrival_time"=>"", "time"=>"Sat, 07 Jul 2012 09:15 pm", "for"=>"", "against"=>"", "home_or_away"=>"", "location_id"=>"", "opponent_id"=>""}, "commit"=>"Create Schedule"}
  Rendered user_mailer/welcome_email.html.erb (0.4ms)

Sent mail to *******@westnet.com.au (60075ms)
Completed 500 Internal Server Error in 60213ms

Timeout::Error (execution expired):
  app/controllers/schedules_controller.rb:59:in `create'
  app/controllers/schedules_controller.rb:56:in `create'

i have the following in my schedule_controller

def create
@schedule = Schedule.new(params[:schedule])
@user = User.find(current_user)

respond_to do |format|
  if @schedule.save
    UserMailer.welcome_email(@user).deliver
    format.html { redirect_to(schedules_url,
                              :notice => "#{event_display_c(@schedule.event)}  was successfully created.") }
    format.json { render :json => @schedule, :status => :created, :location => @schedule }
  else
    format.html { render :action => "new" }
    format.json { render :json => @schedule.errors, :status => :unprocessable_entity }
  end
end

end

and my mailer

    class UserMailer < ActionMailer::Base
  default :from => "notifications@**********"

  def welcome_email(user)
    @user = user
    @url  = "http://example.com/login"
    mail(:to => user.email, :subject => "Welcome to My Awesome Site")
  end
end

Upvotes: 1

Views: 988

Answers (1)

sigre
sigre

Reputation: 371

Looks like the issue is a misconfiguration for your email server. Fixing this is dependent on your ISP/server host, but checkout the Ruby on Rails Guides for details on what to set. There's also steps for configuring your server settings if your using GMail.

Upvotes: 1

Related Questions