we're running ARMailer in one of our projects right now.
It's working fine but as different customers are allowed to send confirmation emails via this service we want to offer them the possibility to use their own SMTP settings for that.
Is there a way to change ARMailer settings on the fly?
Or is there an ARMailer alternative maybe which abstracts this better?
Thanks
Matt
this: Using multiple SMTP accounts with Rails & ActionMailer
has a nice example using yaml for storing the multiple configurations, but can easily be adapted to use the db
What I did in the end was:
I took the ARMailer gem and took a copy of it.
After that, modified the email delivery action and started the daemon from my new custom folder. Works fine. Will create a custom some day...
Related
i need to test the action mailer in my ruby on rails project which is already live.i don't want to go in the mess of creating a new mail server like zimbra on localhost or mess with the configurations of the other environments that i have.moreover i cant think of looking in the log files which will be a complete height of patience.is there any other way to check/debug action mailer in localhost.if yes then how and if not then why not?
Several alternatives:
define an interceptor in development, see this railscast
use letter_opener gem to see the mail instead of actually sending it, link to gem
Before I start the process of building something from scratch I was curious if anyone else had come across a way of providing a first-time configuration wizard for a Rails application that allows the user (sysadmin) to configure aspects of the application such as the ActiveRecord configuration and the ActionMailer setup (SMTP, sender etc).
We'd like to provide a clean easy way for new installs to get setup, rather than asking clients to edit files, or run scripts on the command line.
Essentially you should be able to download the application, extract it, start it, and when you access it via the browser you're guided through the initial setup steps.
My question isn't so much around how to do this, but more has anyone already done this. My quick search for gems, plugins etc around this idea didn't turn up much.
Edit/Clarification
To clarify the scenario - this is to support "shrink-wrapped" products that are downloaded and installed on-premises by the customer's sys admin.
The first time they access our application after deploying it behind their firewall we want a friendly way of configuring the specific settings for their install, such as database etc.
An example of such a process is JIRA's setup wizard:
https://confluence.atlassian.com/display/JIRA/Running+the+Setup+Wizard
This isn't for reating new rails applications, or systemising our development process.
I like Rails Templater a lot. It is a command line tool to build a rails app. It asks you questions like "Would you like to use rspec? Pry instead of IRB?"
I have created a fork that adds authentication, twitter bootstrap and backbone.js and some other options. It is pretty easy to hack on if you have specific needs. I use it all the time and I would hate not having it.
It is of course a command line app and not usable via the browser but maybe it will still fit your needs. Or the codebase could be integrated into a client web application.
Update after comment
You may be able to bootstrap a sqlite database so the app can boot, then just using a form or a wizard to set up something that writes your database.yml and other configs, maybe by means of thor (makes appending/replacing text in files simple and is part of rails). You would need to somehow restart the rails app and migrate the database. You could keep the pg or mysql2 gem (or both) in your Gemfile or again use thor to edit them from your wizard/form.
I also recommend using rails_config as Michael suggested. With the above solution.
If I had more time to think about the problem, I may come up with something cleaner but this is how I would do it if I had to right now.
http://railswizard.org/ lets you select which gems to use. It's a very innovative use of the ui and the isotope gem to select the components. Similarly another viewpoint is this top 10 list: http://blog.teamtreehouse.com/10-must-have-ruby-gems
You'll never find a definitive list of gems as need change from person to person and over time, e.g. which database your company uses and which is the 'current' best authentication gem are both variable.
For configuration specific settings you can make the configuration less of a chore by using practices that reduce it. For example the database.yml file is usually one of the 'must be edited locally' files. Our approach for this to to exclude database.yml from source control by putting its name in our .gitignore file. We add an database.yml.example file which we copy locally to database.yml and in that file we use anchors (&) and references (*) as detailed here: http://blog.geekdaily.org/2010/08/advanced-yaml-tricking-out-your-databaseyml.html
More options for configuring other variables for each environment: http://kpumuk.info/ruby-on-rails/flexible-application-configuration-in-ruby-on-rails/
The rails config gem may also help you as detailed here: How to define custom configuration variables in rails
I want to grant to external people possibility to change translation in my project. I want to use web interface for it. And I want all this changes to be git commited. And, if it possible, I want to see authors of changes, so in the best case this web ui should have users and it's own authorization system.
I found question Is there a web UI for modifying I18n locales for Rails 3?, but this isn't satisfy all conditions (like git for example or different users).
So it would be great if you pointing such Web UIs to me.
P.S. I use Rails 3
Rails Translation Center Gem is awesome! https://github.com/BadrIT/translation_center
It is free; you don't need to pay for such locale or phrase!
We are using https://webtranslateit.com/ with our Rails 3 project.
It has users, translator groups etc. and works pretty well. It can read the changes of the translation files from git, but it cannot commit automatically back. However, for us that has not been a problem as when there are updated translations some of the developers can easily do a "WTI pull" to get newest translations, check that nothing is broken and make a git commit of those.
It seems like the translate app would do what you want, just add git commits to it. There's a storage module. Fork the repo, add git functionality using the ruby-git gem. Make a git commit call after the yml file is written. You'll have to hook the commit.author.name and commit.author.email to your authorization system in Rails to make it "multi-user".
Should be a fun little project.
You can use locale or phrase. They are both free in beta.
Alternatively, you can setup your own translation web service with copycopter.
I'd like to replace our existing Ruby on Rails application with a new version of the site in PHP, but I'm not sure how to remove the rails app from our shared VPS server.
Is there a way to delete the app via FTP or some way to remove it in Cpanel? The developers set it up to use a custom deployment script. Are there any typical uninstall scripts that might remove it?
Ideally, I'd like to avoid completely re-provisioning the server instance because I don't want to lose our blog database and email accounts.
Sorry for such a dumb noob question, but I'd really be grateful for some advice.
Thanks so much!
If its on linux, it should be at /var/www. Remove the database entries and put the PHP versions there too.
I've built a very basic CRM system for my rails app that allows me to send weekly user activity digests with custom text and create multi-part marketing messages which I can configure and send through a basic admin interface. I'm happy with what I've put together on the send-side of things (minus the fact that I haven't tried to volume test its capabilities), but I'm concerned about how to handle bounce-backs.
I came across this plugin with associated scripts: http://github.com/kovyrin/bounces-handler
I'm using Google Apps to handle my mail and really don't know enough about Perl to want to mess with the above plugin - I have enough headaches.
I'm looking for a simple solution for processing bounce-backs in Rails. All my email will go out from an address like this which will be managed in Google Apps: "news#mydomain.com."
What's the best workflow for this? Can anyone post an example solution they're using keeping in mind the fact that I'm using Google Apps for the mail?
Any guidance, links, or basic workflow best-practices to handle this would be greatly appreciated.
Thanks!
-A
Ok, this has proven to be easier then I thought using the Fetcher plugin which you can find on Github. For those interested in an approach that appears to work, here's what I've done:
1) Install the Fetcher plugin like so: script/plugin install git://github.com/look/fetcher.git
2) The instructions suggest you run a generator to create a daemon like so: script/generate fetcher_daemon MailerDaemon. I suggest doing this since it will generate a YML file in config/ which you can modify with your mail server info (in my case Gmail).
It also generates a daemon to run Fetcher. I tried using this but consistently got the following error: Mysql::Error: MySQL server has gone away: SHOW FIELDS FROM email_blacklists. This was the result of the daemon process disappearing before the MySQL could store the record so I abandoned using the daemon and setup a cron instead.
3) configure the .yml file in config which i renamed to mail.yml with your mail settings. For gmail pop, they look something lik this:
development:
type: pop
server: pop.gmail.com
port: 995
ssl: true
username: myemailaddress#gmail.com
password: mypassword
Here's the code you'll need to process:
models/mail_processor.rb
class MailProcessor < ActionMailer::Base
def receive(email)
email = EmailBlacklist.find_or_create_by_email(email.to.first)
end
def self.grab_bounces
config = YAML.load_file("#{RAILS_ROOT}/config/mail.yml")
config = config[RAILS_ENV].to_options
fetcher = Fetcher.create({:receiver => MailProcessor}.merge(config))
fetcher.fetch
end
end
lib/tasks/mail.rake
namespace :email do
desc "sends various types of marketing and automated emails and processes bouncebacks"
task(:process_bounces => :environment) do
MailProcessor.grab_bounces
end
end
You can then toss the auto-generated mailer_daemon_fetcher.rb file in your scripts/ directory.
Hope this helps someone else. If you want to test then, from the console simply call MailProcessor.grab_bounces. Make sure you have some email in the inbox that you're configured to access.