Я столкнулся с теми же проблемами и получил это работать с этим:
Шаг 1. Добавьте в свою среду разработки следующее:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = "utf-8"
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => "587",
:domain => "domain.com",
:authentication => :plain,
:user_name => "YOUR_USER_NAME", #should be you@domain.com
:password => "YOUR_PASSWORD_HERE"
}
Критическая строка: enable_starttls_auto. Вы должны перезапустить вебрик после внесения изменений здесь.
Шаг 2. Создайте модель наподобие project_mailer.rb
class ProjectMailer < ActionMailer::Base
def confirmation(project)
subject 'Your email subject'
recipients project.email
from 'you@domain.com'
body :project => "hi"
end
end
Шаг 3. Создайте представление как /views/project_mailer/confirmation.html.haml (или .erb). Это просто стандартный файл просмотра.
Шаг 4. Добавьте строку в свой контроллер, как:
ProjectMailer.deliver_confirmation(@project)