Is it possible without user_name & password Action mailer configuration in rails ?

150 views
Skip to first unread message

Prasanth Balan

unread,
Oct 6, 2018, 4:27:31 AM10/6/18
to Ruby on Rails: Talk
Hi All,

I need to configure SMTP on production,My client only providing address, is that possible without user_name & password to configure SMTP ?

Mike

unread,
Oct 8, 2018, 4:06:38 AM10/8/18
to Ruby on Rails: Talk
Yes it is, although that implies no security, still, if the mail host is internal that can be acceptable, if the mail host is on the Internet, it will still work, but once people find out about an unauthenticatedcserver it will be abused

fakt...@gmail.com

unread,
Oct 8, 2018, 4:59:41 AM10/8/18
to Ruby on Rails: Talk
On Saturday, October 6, 2018 at 3:27:31 AM UTC-5, Prasanth Balan wrote:
Hi All,

I need to configure SMTP on production,My client only providing address, is that possible without user_name & password to configure SMTP ?

What is your host? If you are using Heroku you can configure SendGrid starter and it will provide a username and password for the mail server it creates for you.

Provision SendGrid like
heroku addons:create sendgrid:starter
Then grab your environment vars with
heroku config:get SENDGRID_USERNAME
heroku config:get SENDGRID_PASSWORD

More information can be found here: https://devcenter.heroku.com/articles/sendgrid 

To use the SMTP mailer you will need to setup an initializer class with something like the following:
So, in config/initializers/setup_mail.rb

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password         => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:enable_starttls_auto => true
} 

 Create a mailer template and invoke from your controller of choice and you've got a working mail in production.

Prasanth Balan

unread,
Oct 8, 2018, 6:26:34 AM10/8/18
to rubyonra...@googlegroups.com
No, We're using AWS server, my client only providing  :domain and :address

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8e4fac18-7433-44d6-bb7f-d67b6e49c552%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Prasanth Balan

unread,
Oct 8, 2018, 6:29:15 AM10/8/18
to rubyonra...@googlegroups.com
Can you give me some reference configurations, please ?

my client only providing  domain name and address

On Mon, Oct 8, 2018 at 1:36 PM Mike <mike.s...@gmail.com> wrote:
Yes it is, although that implies no security, still, if the mail host is internal that can be acceptable, if the mail host is on the Internet, it will still work, but once people find out about an unauthenticatedcserver it will be abused

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Thanks & Regards
Prasanth Balan
9943400291

fakt...@gmail.com

unread,
Oct 8, 2018, 6:31:30 AM10/8/18
to Ruby on Rails: Talk
https://aws.amazon.com/marketplace/pp/B074CQY6KB -- same service.. just on AWS. Worth a look.

Mike Simkins

unread,
Oct 9, 2018, 3:27:26 AM10/9/18
to rubyonra...@googlegroups.com
You need to expand on ‘AWS Server’

Do you mean a VM running Linux and Sendmail/Postfix??

Do you mean the AWS ‘Simple Email Service’(SES)??

or something else ??

All the configs are different so....
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/GOdg_ftrBzw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-ta...@googlegroups.com.

To post to this group, send email to rubyonra...@googlegroups.com.

Prasanth Balan

unread,
Oct 9, 2018, 5:01:41 AM10/9/18
to rubyonra...@googlegroups.com
Hi Mike, Thank you for your reply,

 We want to configure Redhat Linux and Sendmail / Postfix

Please guide me how to configure via Postfix using my client mailer credentials (they're not providing user name and password)

Thanks & Regards
Prasanth


For more options, visit https://groups.google.com/d/optout.


--

Mike Simkins

unread,
Oct 9, 2018, 6:34:23 AM10/9/18
to rubyonra...@googlegroups.com
It is all fairly well explained in the rails guides however:

If your mailer is on the same box as your web app use something like......

config.action_mailer.delivery_method = :sendmail
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_options = { from: ‘my...@mydomain.com’ }


If the sendmail instance is running on a different box, then you have to use SMTP.

Delete the first line above (:sendmail), and replace with

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
port: 25, # might be 587
address: ‘mymailer.domain.com
}

Prasanth Balan

unread,
Oct 23, 2018, 7:15:51 AM10/23/18
to rubyonra...@googlegroups.com
Thank you Mike, it's working now


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages