Emails sent in development via Gmail but not in production from Heroku

71 views
Skip to first unread message

SS

unread,
Jan 23, 2010, 8:15:23 PM1/23/10
to CommunityEngine
Hi Guys,
I'm experiencing problems sending automated emails via Gmail from
Heroku server (Production)? I can successfully send emails in
Development environment upon new user registration, however when I try
in Production there is no emails sent and makes me a little
frustrated.

I don't see a problem with my code in ../environment/production.rb:

----------------------Start Code---------------------------

APP_URL = "http://mysite.heroku.com"

config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true

config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:authentication => :plain,
:user_name => 'myemial...@gmail.com',
:password => 'password1'
}
-------------------------End Code---------------------

I don't understand why it doesn't work. Is the APP_URL the problem? In
Development APP_URL = "http://localhost:3000/" works fine. I tried
different variations and restarted my Heroku server after each time to
ensure that the configuration files are loaded with the updated
changes.

Please help...

SS

SS

unread,
Feb 2, 2010, 3:00:39 PM2/2/10
to CommunityEngine
Okay, I found out the solution.
I needed tls library. I still don't understand quite why it worked
only in dev without tls, I think Heroku is using out of date library.

So, you need to find tls_smtp.rb online and add it to your lib dir in
your rails project.

1. I added this snippet in my config/environments/production.rb

config.action_mailer.smtp_settings = {
:tls => true,


:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',

:user_name => "mye...@gmail.com",
:password => "*****",
:authentication => :plain
}


2. Imported in my environment.rb
require 'tls_smtp' (right under "require File.join(File.dirname
(__FILE__), 'boot')")


Hope this helps to any of you that have the same problems!

Cheers,
SS

On Jan 23, 6:15 pm, SS <stoyan.stoitch...@gmail.com> wrote:
> Hi Guys,
> I'm experiencing problems sending automated emails via Gmail from
> Heroku server (Production)? I can successfully send emails in
> Development environment upon new user registration, however when I try
> in Production there is no emails sent and makes me a little
> frustrated.
>
> I don't see a problem with my code in ../environment/production.rb:
>
> ----------------------Start Code---------------------------
>
> APP_URL = "http://mysite.heroku.com"
>
> config.cache_classes = true
> config.action_controller.consider_all_requests_local = false
> config.action_controller.perform_caching = true
>
> config.action_mailer.raise_delivery_errors = false
> config.action_mailer.delivery_method = :smtp
> config.action_mailer.smtp_settings = {
>         :enable_starttls_auto => true,
>         :address => "smtp.gmail.com",
>         :port => 587,
>         :domain => 'gmail.com',
>         :authentication => :plain,

>         :user_name => 'myemialacco...@gmail.com',

Reply all
Reply to author
Forward
0 new messages