Sha256: 5b89ced2fc057a9b16f7d28833d107f5099333d5eb403dfbf5bd2050521f401b
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 Bytes
Contents
TMail::Mail.class_eval do def override_recipients!(recipients) recipients = Array(recipients) original_addresses = { :to => override(:to, recipients), :cc => override(:cc, recipients), :bcc => override(:bcc, recipients) } parts = [ "--- Original recipients ---" ] [ :to, :cc, :bcc ].each do |target| parts << target.to_s.capitalize + ": " + (original_addresses[target] ? original_addresses[target].join(', ') : '(none)') end parts << "---------------------------" line_break = self.content_type =~ /(html)/ ? "<br />" : "\n" self.body = parts.join(line_break) + line_break*2 + self.body end def override(method, recipients) original_recipients = send("#{method}") self.send "#{method}=", recipients if original_recipients original_recipients end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mail_magnet-0.2.0 | lib/mail_magnet/tmail_ext.rb |