Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #app/controllers/feedback_info_controller.rb
- def send_mail
- smtp = Net::SMTP.new( "smtp.yandex.ru", 587 )
- smtp.enable_starttls
- smtp.start( "yandex.ru", "my_adr@yandex.ru", "пароль", :plain ) do |conn|
- conn.send_message "Сообщение", "my_adr@yandex.ru", "получатель@rambler.ru"
- end
- by mx2.mail.rambler.ru (Postfix) with ESMTP id 65FF15CA8
- for <получатель@rambler.ru>; Mon, 24 Aug 2015 11:13:46 +0300 (MSK)
- by forward22m.cmail.yandex.net (Yandex) with ESMTP id 488F18046B
- for <получатель911@rambler.ru>; Mon, 24 Aug 2015 11:13:46 +0300 (MSK)
- by smtp3m.mail.yandex.net (Yandex) with ESMTP id 2C1A127A05B8
- for <получатель911@rambler.ru>; Mon, 24 Aug 2015 11:13:46 +0300 (MSK)
- #app/mailers/application_mailer.rb
- class ApplicationMailer < ActionMailer::Base
- end
- #app/mailers/feedback_mailer.rb
- class FeedbackMailer < ApplicationMailer
- def feedback_email
- mail(from: 'my_adr@yandex.ru', to: 'получатель@rambler.ru', subject: 'тема')
- end
- end
- #app/controllers/feedback_info_controller.rb
- def feedback_send
- FeedbackMailer.feedback_email
- end
- #config/environments/development.rb
- config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
- config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = {
- address: 'smtp.yandex.ru',
- port: 587,
- domain: 'yandex.ru',
- authentication: 'plain',
- user_name: 'my_adr@yandex.ru',
- password: 'пароль',
- enable_starttls_auto: true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement