Difference between ActiveMailer and Mail gem? - ruby-on-rails

In ruby on rails 3 you can use their ActiveMailer for sending emails.
Also you can install the Mail gem.
I wonder what the difference is?
Does the Mail gem provide things ActiveMailer doesnt?
Should i always install this gem?
Thanks

The relationship between the two is that the Mail gem is how Rails 3 implements mail ( replacing the previous TMail approach in earlier versions). In other words, ActionMailer is the Rails wrapper around the Mail gem's usage within the framework.
From a post by the gem's author:
The prior versions of ActionMailer used TMail for all its email delivery needs, and because certain functionality was missing in TMail (such as auto quoting and encoding of fields, handling multipart emails smoothly, etc.), ActionMailer had grown a set of fairly complex and fragile methods to shoehorn in the missing functionality.
That post is here. And this screencast might be helpful if you haven't seen it already.

Related

Gem for Send/ Receive e-mails in Rails 4 admin panel

Basically, I am searching for advise to choose best gem for Sending/Receiving e-mails in Rails 4 admin panel. Main requirement would be that gem can't be for specific domain e-mails like Gmail, Yahoo and etc.
At this moment I found mikel/mail
What you think of this gem ? Or can you suggest better one ?
Thanks in advance.
There's actionmailer, which will already by bundled with your Rails installation. Integration with your Rails app would be easier with actionmailer than any 3rd party gems, since that's what it was designed for.

if defined?(ActionController) and defined?(ActionController::Base)

Its a code snippet from act_as_audited plugin 1.1.1 under rails/init.rb
Why is this code used? Any general explanation of it is welcomed.
if defined?(ActionController) and defined?(ActionController::Base)
acts_as_audited is intended to be usable with plain ActiveRecord. As you can use ActiveRecord outside of Rails, e.g. in a Sinatra app, it is helpful if a gem doesn't tie itself to Rails.
This is exactly what is happening here: the authors try to detect if they are running under Rails (or more specifically, if the app uses ActionController for routing which is part of Rails) to load additional Rails-specific functionality.
For apps not using ActionController (or Rails), the gem is thus still usable.
It seems that they have dropped this compatibility layer in later releases. This, the successor of acts_as_audited (called just audited) depends on Rails now.

Rails - Mention the gem/plugin to implement inbox feature

In rails 3 (or above), I want to implement a messaging system, which gem or plugin I can use for it? Please help me to implement a inbox feature with all actions in my rails project.
https://github.com/jongilbraith/simple-private-messages is this gem will suits for all inbox actions in rails 4.1 ?
Here I would suggest you mailboxer gem,
https://github.com/mailboxer/mailboxer
By this, you can get messaging system and inbox features like real time mailing system.

ruby on rails(amistad gem)

I want to maintain a friendship within my application for the users to send request and with accept/reject functionalities. I'm using rails 3.2.5 and ruby 1.9.3. I tried the same with amistad gem but unluckily it didn't work. the "include Amistad::FriendshipModel" in amistad is not including in my User model. I cannot find what is the reason for that. can you suggest me some other gem for this functionality in ruby on rails?
An alternative to Amistad is Amico - Relationships (e.g. friendships) backed by Redis.
In general a few more gems might also fit your needs: ActiveRecord Reputation System by Twitter or the Community Engine gem.

What's the benefit of using mailman gem over ActionMailer?

I'm trying to understand what the benefit is here; the only I can see is avoiding a rails bootstrap every time an email is received, but I imagine this is possible with ActionMailer as well with a bit of set up. Any help would be very useful.
Chris.
http://rubygems.org/gems/mailman
The benefit is to avoid the Rails overhead, and it provides some syntax sugar. Also to avoid having to write it yourself.
The fact is though that the underpinnings of the Mailman Micro-framework are essentially the same as ActionMailer the Mail gem. You can achieve the same results using ActionMailer or just Mail without the added dependencies. It just really depends on your use case, and how much you want to write yourself.

Resources