def mail(*args, &block) mail = super category = category(mail) new_body_source = '' position = 0 mail.body.raw_source.each_line do |line| url_match = line.match(/href\s*=\s*["|'](#{Settings.site_url}[^"^']*)["|']/) new_body_source << line and next if url_match.blank? url_str = url_match[1].to_s new_url_str = set_params(url_str, category) new_body_source << line.sub(url_str, new_url_str) end mail.body.raw_source.replace(new_body_source) mail end end