Contact Form Mailer in Rails 4

前端 未结 1 1910
孤独总比滥情好
孤独总比滥情好 2020-12-08 01:16

I am trying to build a contact form in Rails 4, where the form takes a name, email, and body and sends it to my email address. Upon clicking \"Submit\", the app redirects ba

相关标签:
1条回答
  • 2020-12-08 02:08

    It turned out that I hadn't configured my Heroku app with an external SMTP service (since I have never done anything with email before, I didn't know to do this). Since I'm relatively familiar with MailChimp, and especially since their Mandrill service has a free tier (I am building this app for a student organization), I easily added Mandrill to my Heroku app and included the following settings in application.rb:

    ActionMailer::Base.smtp_settings = {
        address: 'smtp.mandrillapp.com',
        port: 587,
        user_name: ENV['MANDRILL_USERNAME'],
        password: ENV['MANDRILL_APIKEY']
    }
    

    Where the ENV vars were set automatically by the add-on.

    0 讨论(0)
提交回复
热议问题