Module: MailSpy::EmailHelper
- Defined in:
- app/helpers/mail_spy/email_helper.rb
Instance Method Summary collapse
-
#track_link(*args, &block) ⇒ Object
Support for link clicks.
-
#tracking_bug ⇒ Object
Support for open tracking, client support, etc.
Instance Method Details
#track_link(*args, &block) ⇒ Object
Support for link clicks.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/helpers/mail_spy/email_helper.rb', line 7 def track_link(*args, &block) @_track_count ||= 0 if block_given? = args.first || {} = args.second track_link(capture(&block), , ) else @_track_count += 1 name = args[0] = args[1] || {} = args[2] = (, ) url = url_for() href = ['href'] = () # Inject our tracking url, and pass in the redirect_url hash = { :controller => "mail_spy/tracking", :action => :link, :url => url, :only_path => false, :host => MailSpy.tracker_host, :n => @_track_count, :eid => @_email.id } url = url_for(hash) href_attr = "href=\"#{ERB::Util.html_escape(url)}\"" unless href "<a #{href_attr}#{}>#{ERB::Util.html_escape(name || url)}</a>".html_safe end end |
#tracking_bug ⇒ Object
Support for open tracking, client support, etc
46 47 48 49 50 51 52 53 54 55 |
# File 'app/helpers/mail_spy/email_helper.rb', line 46 def tracking_bug url = url_for( :controller => "mail_spy/tracking", :action => :bug, :eid => @_email.id, :only_path => false, :host => MailSpy.tracker_host ) "<img src='#{url}' style='display:none' width='1' height='1' border='0' />".html_safe end |