开发者

SendGrid not sending emails on Heroku from default inqury/contact form

开发者 https://www.devze.com 2023-02-08 17:43 出处:网络
This is my first app using RefineryCMS. The way I have sent mail from applications in the past is not cu开发者_JS百科rrently work with my refinery app.

This is my first app using RefineryCMS. The way I have sent mail from applications in the past is not cu开发者_JS百科rrently work with my refinery app.

I have tried numerous ways of doing this by way of numerous searches on the internet and I cannot make this work.

Currently, here is what I have:

In the environment.rb file I have this:

config.action_mailer.smtp_settings = {
    :enable_starttls_auto => true,
    :address        => 'smtp.sendgrid.net',
    :port           => '25',
    :authentication => :plain,
    :user_name      => 'myusername@mydomain.com',
    :password       => 'mypassword',
    :domain         => 'mydomain'
  }

I have also tried:

ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    :address        => 'smtp.sendgrid.net',
    :port           => '25',
    :authentication => :plain,
    :user_name      => 'myusername@mydomain.com',
    :password       => 'mypassword',
    :domain         => 'mydomain'
  }

I have tried putting these settings in the production and development classes. Tried locally and on heroku but I just can't get the built in inquiry/contact form to send out the notifications emails and I have no idea why it won't work.

Like I said earlier, I have tried every solution (they are all very similar) I can find for this but can't make it work. If somebody could please tell what I am doing wrong and what, exactly, it is I need to do, that would be awesome.

Thanks in advance, ~Mike


Actually, it was a bug in the existing version of refinerycms-inquiries that was causing the mail not to send. once I updated to 0.9.9.9, it worked as expected. In case anyone needs to know how to perform this update:

First, add this line to your Gem file:

gem 'refinerycms-inquiries',    '~> 0.9'

Then run this command:

bundle update refinerycms-inquiries

and this is all I added to the environment.rb file:

ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    :address        => 'smtp.sendgrid.net',
    :port           => '25',
    :authentication => :plain,
    :user_name      => 'myemail@domain.com',
    :password       => 'mypassword',
    :domain         => 'mydomain.com'
}

That's it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号