class MainsController < ApplicationController
	def index
		@albums = Album.all
		@images = Image.all
		@contact = Contact.new
		@projects = Album.order("created_at DESC")
	end

	def create
		@contact = Contact.new
		@contact.request = request
		if @contact.deliver
			flash.now[:error] = nil
		else
			flash.now[:error] = "Can not send message."
			redirect_to root_path
		end
	end
end
class MainsController < ApplicationController
	def index
		@albums = Album.all
		@images = Image.all
		@contact = Contact.new
		@projects = Album.order("created_at DESC")
	end

	def create
		@contact = Contact.new
		@contact.request = request
		if @contact.deliver
			flash.now[:success] = "The email has been sent"
		else
			flash.now[:alert] = "Can not send message."
			redirect_to root_path
		end
	end
end
Refactor email code for production heroku
Refactor email code for production heroku
