Loomio
Sun 24 Aug 2014 4:37PM

loomio smtp email config

E edo Public Seen by 54

i'm trying to setup the email config for loomio , i added those config into the loomio production.rb :

  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  # Send emails using SMTP service
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address        => ENV['SMTP_SERVER'],
    :port           => ENV['SMTP_PORT'],
    :authentication => :plain,
    :user_name      => ENV['SMTP_USERNAME'],
    :password       => ENV['SMTP_PASSWORD'],
    :domain         => ENV['SMTP_DOMAIN']
  }

  config.action_mailer.raise_delivery_errors = true

but i am unable to find error log , i know my config should be wrong my mail server is configured to use ssl .... but postfix should log somethig. what am i missing ?

E

edo Wed 27 Aug 2014 10:42PM

ok , i have never used delayed jobs in rails . Now i executed the bundle exec rake jobs:work and after an hour of study and research i menaged to configure the email to use starttls and password encryption and self singed certificate.
i added those configuration to action_mailer config
:openssl_verify_mode => 'none',
:enable_starttls_auto => true,
:authentication => :cram_md5,

D

Denjello Sun 25 Jan 2015 4:15PM

Yeah, I can totally relate. I was getting this weird error that Roadie couldn't find the email.css file. I finally got it to work with the following config stuff (I believe I turned off HTML mail):

  config.roadie.url_options = nil
  config.action_mailer.default_url_options = {
    host: "10.10.10.10",
    port:3000 
  }
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    domain: "10.10.10.10",
    authentication: "password",
    enable_starttls_auto: true,
    user_name: ENV["SMTP_USERNAME"],
    address: ENV["SMTP_SERVER"],
    password: ENV["SMTP_PASSWORD"],
    port: ENV["SMTP_PORT"]
  }
MI

mix irving Mon 26 Jan 2015 1:11AM

@robertguthrie do you have any insight on this.

@jameskiesel I've just added you to this loomio group so you can see / comment as well

D

Denjello Sat 7 Feb 2015 1:27PM

And by the way, you need to have sendmail installed.

D

Denjello Sun 8 Feb 2015 3:24PM

Furthermore, I am at a bit of a loss as to why I need to run bundle exec rake jobs:work RAILS_ENV="production" in order to send mail invitations / messages.

MI

mix irving Sun 8 Feb 2015 10:08PM

because a lot/ all of the mailers on are on delayed_job, as i nthe mail is sent asynchronously by a worker which the rake task spins up

look in the mailers and you'll see something like
ThreadMailer.delay.new_discussion(user, event)
https://github.com/loomio/loomio/blob/bab6815f24d9dfdc65d74eaa4d907f429fc710ca/app/models/events/new_discussion.rb#L13 ( https://github.com/loomio/loomio/blob/bab6815f24d9dfdc65d74eaa4d907f429fc710ca/app/models/events/new_discussion.rb#L13 )

instead of
ThreadMailer.new_discussion(user, event).deliver

D

Denjello Mon 9 Feb 2015 9:39AM

Actually, my problem was that because I am not on Heroku, the Procfile is not being called. I need to run that command seperately. Moving this issue to Github.

M

mc0e Mon 9 Feb 2015 10:03AM

I'm fairly new to loomio, but if the delivery method is smtp, then I highly doubt that you need sendmail installed.

Also, if you do need 'sendmail' for something, be clear that the original sendmail software is an antiquity, but it defined what has become an interface standard, so pretty much any MTA software these days provides a /usr/bin/sendmail binary which supports the interface of the old sendmail software.

DU

Deleted account Tue 3 Mar 2015 3:29PM

what would be the correct SMTP settings using gmail since I use this configuration in production.rb

config.active_support.deprecation = :notify
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { host: "example.com" }

# Send emails using SMTP service
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => ENV['smtp.gmail.com'],
:port => ENV['587'],
:authentication => :plain,
:user_name => ENV['email@gmail.com'],
:password => ENV['password'],
:domain => ENV['gmail.com'],
:openssl_verify_mode => 'none'

}

config.action_mailer.raise_delivery_errors = true

but I get the following error

Processing by Devise::PasswordsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"4m98haLFChrdBsiUaRp7WXeCkyuBeq5cvtMlm16sG/I=", "user"=>{"email"=>"robert15497@gmail.com"}, "commit"=>"Send me reset password instructions"}
Rendered devise/mailer/reset_password_instructions.html.haml (4.2ms)

Sent mail to robert15497@gmail.com (40.7ms)
Completed 500 Internal Server Error in 786ms

Net::SMTPSyntaxError (501 Syntax: HELO hostname
):
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/net/smtp.rb:957:in check_response'
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/net/smtp.rb:926:in
getok'
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/net/smtp.rb:830:in helo'
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/net/smtp.rb:604:in
do_helo'
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/net/smtp.rb:556:in do_start'
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/net/smtp.rb:520:in
start'
mail (2.6.3) lib/mail/network/delivery_methods/smtp.rb:112:in deliver!'
mail (2.6.3) lib/mail/message.rb:2141:in
do_delivery'
mail (2.6.3) lib/mail/message.rb:236:in block in deliver'
actionmailer (4.1.9) lib/action_mailer/base.rb:527:in
block in deliver_mail'
activesupport (4.1.9) lib/active_support/notifications.rb:159:in block in instrument'
activesupport (4.1.9) lib/active_support/notifications/instrumenter.rb:20:in
instrument'
activesupport (4.1.9) lib/active_support/notifications.rb:159:in instrument'
actionmailer (4.1.9) lib/action_mailer/base.rb:525:in
deliver_mail'
mail (2.6.3) lib/mail/message.rb:236:in `deliver'

thank you for your help
URL: http://162.243.114.220/