sendgrid port 2525 not working in Rails app - ruby-on-rails

I am trying to use the Google Cloud offer for SendGrid in a Rails app. In my config/environment/production.rb, I have:
config.action_mailer.delivery_method = :smtp
# SMTP Settings for use with SendGrid
ActionMailer::Base.smtp_settings =
{
:user_name => "myusername",
:password => "mypassword",
:domain => "mydomain",
:address => "smtp.sendgrid.net",
:port => 2525,
:authentication => :plain,
:enable_starttls_auto => true
}
It connects instantly and instantly I get an error:
Net::SMTPAuthenticationError (535 Authentication failed: Bad username / password
I can go there on the web and login with the same credentials, no problem. Anyone have any ideas why this is happening?

This turned out to be an rvm issue. Uninstalling and reinstalling rvm fixed this.

Related

How to configure Rails mailer with a non-gmail account?

I have a rails mailer that I want to configure with an email account that is non-gmail, and is accessed through outlook. the SMTP address is "smtp.us.exg7.exghost.com". The email is not #exghost.com.
I am running into a 504 5.7.4 unrecognized authentication type error.
Here is my configuration:
config.action_mailer.smtp_settings = {
:address => "smtp.us.exg7.exghost.com",
:port => "587",
:domain => "exghost.org",
:user_name => 'example#example.org',
:password => 'Password',
:authentication => "plain",
:enable_starttls_auto => true
}
Does anyone have any insight into this? I have tried various domains- exghost.com, us.exg7.exghost.com, example.org. I have tried changing authentication from "plain" to "login", but nothing seems to change the error.
I know that in gmail you have to allow third-party access, does this need to be done with other formats?

rails emails from heroku

I am trying to send emails through my godaddy shared hosting account.
I have setup the email: hello#example.com
In rails i have the following in both:
app/config/environments/development
app/config/environments/production
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'mail.thaismilejersey.com',
:port => '25',
:authentication => :plain,
:user_name => ENV['EMAIL_ADDRESS'],
:password => ENV['EMAIL_PASSWORD'],
:domain => 'thaismilejersey.com',
:enable_starttls_auto => true,
:openssl_verify_mode => 'none'
}
When I run this in both development and production locally, the emails are sent and I receive them fine.
When I deploy to heroku, everything seems to work, but the emails never actually arrive in my inbox.
ps: I have tried specifying the username and password directly rather than variables but it makes no difference.
Does anyone have any experience doing this or could help me out at all?
Thanks

Sending Mail in Rails App Heroku

I have Users that are able to invite others by email to a project they are working on but I keep getting the following error-
Net::SMTPAuthenticationError
Here is how I have mail settings configured for my production environment
config.action_mailer.default_url_options = { :host => 'myapp.herokuapp.com' }
#Sending email on the production side
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => "587",
:domain => "gmail.com",
:authentication => :plain,
:user_name => "example#gmail.com",
:password => "password"
}
It works in my local environment using sqlite3 as I expect but when I push to heroku it throws the above error after running heroku logs. I believe my config settings to be correct and obviously heroku uses postgresql, so what am I missing here?
Thanks for you r attention.
I found the reason here How to send confirmation e-mails using gmail smtp service for registration using devise under development mode locally?
Google had detected some "suspicious" activity on the newly created account and was blocking me from sending emails. After verifying the account I was able to send emails with the above config and switching :domain => "heroku.com"

Will switching on two-factor authentication stop my Heroku app accessing the Gmail server?

In the past, I've sent email from Heroku apps using the Gmail server, like this:
config.action_mailer.deconfig.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'derp'
:user_name => 'derp.bot',
:password => 'derp42069',
:authentication => 'plain',
:enable_starttls_auto => true }
Since then I've enabled two-factor authentication for most of my domains. Before I do the same for my latest domain, will in wreck havoc with Rails code like you see above?
If the change does break your code, you could fix work around it by using an application-specific password.

Delivery issues with Rails + Gmail SMTP in Dreamhost

I just released a Rails app in Dreamhost and I'm using Google Apps for my domain to handle Emai. I created the admin#domain.com account to serve as the sender authentication.
I installed smtp-tls plugin and my smtp conf is:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "www.domain.com",
:authentication => :plain,
:user_name => "admin#domain.com",
:password => 'secret'
}
The problem: Emails sometimes arrives, and sometimes don't. The recipient addresses are not exclusively Yahoo or GMail accounts, so I think it's not a spam issue. Any ideas? Thanks!
If you want better tracking of whether or not your emails are getting where you're trying to send them, checkout PostageApp:
http://postageapp.com/

Resources