module MailManager
- Author
-
Chris Hauboldt (biz@lnstar.com)
- Copyright
-
2009 Lone Star Internet Inc.
Worker used to check for ready Mailings and process/send them.
- Author
-
Chris Hauboldt (biz@lnstar.com)
- Copyright
-
2009 Lone Star Internet Inc.
Worker used to check for ready Messages and process/send them.
- Author
-
Chris Hauboldt (biz@lnstar.com)
- Copyright
-
2009 Lone Star Internet Inc.
Worker used to check for ready Mailings and process/send them.
Constants
- Lock
- LockException
- PLUGIN_ROOT
used to easily know where the mail manager gem files are
- VERSION
Public Class Methods
can be used to inject cancan abilities into your application
# File lib/mail_manager/engine.rb, line 112 def self.abilities <<-EOT if MailManager.authorized?(user) can :manage, [ MailManager::Mailing, MailManager::MailingList, MailManager::Contact, MailManager::Subscription, MailManager::Bounce, MailManager::Message ] can [:send_test, :test, :schedule, :cancel], MailManager::Mailing can [:dismiss, :fail_address], MailManager::Bounce can [:delete, :undelete], MailManager::Contact end can [:subscribe, :double_opt_in, :thank_you], MailManager::Contact can [:unsubscribe, :unsubscribe_by_email_address], MailManager::Subscription EOT end
easily get a path to the gem's assets
# File lib/mail_manager/engine.rb, line 139 def self.assets_path File.join(PLUGIN_ROOT,'assets') end
gives the url for a contactable object (such as users or members or whatever you set up for mapping to your contacts
# File lib/mail_manager/engine.rb, line 134 def self.edit_route_for(contactable) ContactableRegistry.edit_route_for(contactable.is_a?(String) ? contactable : contactable.class.name) end
sets up your MailManager.blah configuration options from config/mail_manager.yml and can override those with config/mail_manager.local.yml for development environments
# File lib/mail_manager/engine.rb, line 155 def self.initialize_with_config(conf) MailManager.secret ||= conf.secret rescue nil default_url_options = ActionController::Base.default_url_options default_site_url = "#{default_url_options[:protocol]||'http'}://#{default_url_options[:domain]}" MailManager.site_url ||= conf.site_url || default_site_url rescue default_site_url MailManager.dont_include_images_domains ||= conf.dont_include_images_domains || [] rescue [] MailManager.sleep_time_between_messages ||= conf.sleep_time_between_messages || 0.3 rescue 0.3 if conf.params.has_key?('table_prefix') MailManager.table_prefix ||= conf.table_prefix.to_s # allow empty else MailManager.table_prefix ||= 'mail_manager_' end MailManager.default_from_email_address ||= conf.default_from_email_address rescue nil MailManager.deliveries_per_run ||= (conf.deliveries_per_run || 50) rescue 50 MailManager.signup_email_address ||= conf.signup_email_address rescue nil MailManager.bounce ||= conf.bounce || {} rescue {} MailManager.unsubscribe_path ||= conf.unsubscribe_path || "/listmgr" rescue "/listmgr" MailManager.subscribe_path ||= conf.subscribe_path || "/listmgr/subscribe" rescue "/listmgr/subscribe" MailManager.double_opt_in_path ||= conf.double_opt_in_path || "/listmgr/confirm" rescue "/listmgr/confirm" MailManager.honey_pot_field ||= conf.honey_pot_field || "company_name" rescue "company_name" MailManager.subscribe_thank_you_path ||= conf.subscribe_thank_you_path || "/listmgr/subscribe_thank_you" rescue "/listmgr/subscribe_thank_you" MailManager.site_path ||= conf.site_path || "/" rescue "/" MailManager.layout ||= conf.layout || "mail_manager/application" rescue "mail_manager/application" MailManager.public_layout ||= conf.public_layout || "mail_manager/application" rescue "mail_manager/application" MailManager.use_show_for_resources ||= conf.use_show_for_resources || false rescue false MailManager.show_title ||= conf.show_title || true rescue true MailManager.requires_authentication ||= conf.requires_authentication || false rescue false MailManager.authorized_roles ||= conf.authorized_roles || [] rescue [] MailManager.roles_method ||= conf.roles_method || nil rescue nil MailManager.register_generic_mailable ||= conf.register_generic_mailable || false rescue false MailManager.exception_notification = {} MailManager.exception_notification[:to_addresses] ||= conf.exception_notification['to_addresses'] || [] rescue [] MailManager.exception_notification[:from_address] ||= conf.exception_notification['from_address'] || nil rescue nil end
# File lib/mail_manager/engine.rb, line 143 def self.public_path?(path) [ MailManager.subscribe_path, MailManager.unsubscribe_path, MailManager.double_opt_in_path, MailManager.subscribe_thank_you_path ].detect{|public_path| public_path =~ /#{path}/i}.present? end