Answer the question
In order to leave comments, you need to log in
How to hide mailbox access when using mail in ruby?
There is a script that sends the result of the work to the mail via SMTP using gem mail. I want to put the script in a public repository, but I don't want to burn access to the mail. What is the best way to move the submit options to a separate file to add it to .gitignore?
I send like this:
options = { :address => "smtp.gmail.com",
:port => 587,
:domain => 'domain.com',
:user_name => '[email protected]',
:password => 'mail_password',
:authentication => 'plain',
:enable_starttls_auto => true }
Mail.defaults do
delivery_method :smtp, options
end
#Sending
Mail.deliver do
from '[email protected]'
to '[email protected]'
subject 'some subject'
html_part do
content_type 'text/html; charset=UTF-8'
body "#{html_mail}"
end
end
Answer the question
In order to leave comments, you need to log in
Ruby usually uses yaml to store configs. Read/write in this format is in the standard Ruby library
The figaro gem should work. Move the options to environment variables and you'll be happy :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question