include people names in the from field
This commit is contained in:
parent
2185df3f52
commit
75aa3f8f97
8 changed files with 34 additions and 25 deletions
2
Gemfile
2
Gemfile
|
|
@ -78,7 +78,7 @@ gem 'hoptoad_notifier'
|
|||
gem 'newrelic_rpm', :require => false
|
||||
|
||||
#mail
|
||||
gem 'messagebus_ruby_api', '0.4.0'
|
||||
gem 'messagebus_ruby_api', '0.4.8'
|
||||
|
||||
# tags
|
||||
|
||||
|
|
|
|||
18
Gemfile.lock
18
Gemfile.lock
|
|
@ -139,7 +139,7 @@ GEM
|
|||
uuidtools
|
||||
childprocess (0.2.2)
|
||||
ffi (~> 1.0.6)
|
||||
closure-compiler (1.1.3)
|
||||
closure-compiler (1.1.4)
|
||||
cloudfiles (1.4.10)
|
||||
mime-types (>= 1.16)
|
||||
columnize (0.3.4)
|
||||
|
|
@ -199,7 +199,7 @@ GEM
|
|||
nokogiri (~> 1.4.3.1)
|
||||
ruby-hmac
|
||||
foreigner (0.9.1)
|
||||
foreman (0.22.0)
|
||||
foreman (0.24.0)
|
||||
term-ansicolor (~> 1.0.5)
|
||||
thor (>= 0.13.6)
|
||||
formatador (0.2.1)
|
||||
|
|
@ -245,7 +245,7 @@ GEM
|
|||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
messagebus_ruby_api (0.4.0)
|
||||
messagebus_ruby_api (0.4.8)
|
||||
mime-types (1.16)
|
||||
mini_magick (3.2)
|
||||
subexec (~> 0.0.4)
|
||||
|
|
@ -325,10 +325,10 @@ GEM
|
|||
oa-more (= 0.2.6)
|
||||
oa-oauth (= 0.2.6)
|
||||
oa-openid (= 0.2.6)
|
||||
open4 (1.1.0)
|
||||
open4 (1.2.0)
|
||||
orm_adapter (0.0.5)
|
||||
parallel (0.5.9)
|
||||
parallel_tests (0.6.4)
|
||||
parallel_tests (0.6.7)
|
||||
parallel
|
||||
polyglot (0.3.2)
|
||||
pyu-ruby-sasl (0.0.3.3)
|
||||
|
|
@ -422,9 +422,9 @@ GEM
|
|||
rubyzip
|
||||
settingslogic (2.0.6)
|
||||
simple_oauth (0.1.5)
|
||||
sinatra (1.2.6)
|
||||
sinatra (1.2.7)
|
||||
rack (~> 1.1)
|
||||
tilt (< 2.0, >= 1.2.2)
|
||||
tilt (>= 1.2.2, < 2.0)
|
||||
sqlite3 (1.3.4)
|
||||
subexec (0.0.4)
|
||||
systemu (2.4.0)
|
||||
|
|
@ -449,7 +449,7 @@ GEM
|
|||
typhoeus (0.2.4)
|
||||
mime-types
|
||||
mime-types
|
||||
tzinfo (0.3.29)
|
||||
tzinfo (0.3.30)
|
||||
uuidtools (2.1.2)
|
||||
vegas (0.1.8)
|
||||
rack (>= 1.0.0)
|
||||
|
|
@ -506,7 +506,7 @@ DEPENDENCIES
|
|||
json (= 1.4.6)
|
||||
jwt (= 0.1.3)
|
||||
linecache (= 0.43)
|
||||
messagebus_ruby_api (= 0.4.0)
|
||||
messagebus_ruby_api (= 0.4.8)
|
||||
mini_magick (= 3.2)
|
||||
mobile-fu
|
||||
mock_redis
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module NotificationMailers
|
|||
@comment = Comment.find_by_id(comment_id)
|
||||
|
||||
if mail?
|
||||
@headers[:from] = "[#{@comment.author.name} (Diaspora)] <#{AppConfig[:smtp_sender_address]}>"
|
||||
@headers[:from] = "#{@comment.author.name} (Diaspora*) <#{AppConfig[:smtp_sender_address]}>"
|
||||
@headers[:subject] = truncate(@comment.parent.comment_email_subject, :length => TRUNCATION_LEN)
|
||||
@headers[:subject] = "Re: #{@headers[:subject]}"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module NotificationMailers
|
|||
def set_headers(comment_id)
|
||||
@comment = Comment.find(comment_id)
|
||||
|
||||
@headers[:from] = "[#{@comment.author.name} (Diaspora)] <#{AppConfig[:smtp_sender_address]}>"
|
||||
@headers[:from] = "#{@comment.author.name} (Diaspora*) <#{AppConfig[:smtp_sender_address]}>"
|
||||
@headers[:subject] = truncate(@comment.parent.comment_email_subject, :length => TRUNCATION_LEN)
|
||||
@headers[:subject] = "Re: #{@headers[:subject]}"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module NotificationMailers
|
||||
class ConfirmEmail < NotificationMailers::Base
|
||||
def set_headers
|
||||
@headers[:to] = "\"#{recipient_name}\" <#{@recipient.unconfirmed_email}>"
|
||||
@headers[:to] = "#{recipient_name} <#{@recipient.unconfirmed_email}>"
|
||||
@headers[:subject] = I18n.t('notifier.confirm_email.subject', :unconfirmed_email => @recipient.unconfirmed_email)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module NotificationMailers
|
|||
@conversation = @message.conversation
|
||||
@participants = @conversation.participants
|
||||
|
||||
@headers[:from] = "[#{@message.author.name} (Diaspora)] <#{AppConfig[:smtp_sender_address]}>"
|
||||
@headers[:from] = "#{@message.author.name} (Diaspora*) <#{AppConfig[:smtp_sender_address]}>"
|
||||
@headers[:subject] = @conversation.subject.strip
|
||||
@headers[:subject] = "Re: #{@headers[:subject]}" if @conversation.messages.size > 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
module Messagebus
|
||||
class Mailer
|
||||
unless defined?(MessagebusRubyApi::VERSION)
|
||||
MessagebusRubyApi::VERSION = '0.4.8'
|
||||
end
|
||||
|
||||
def initialize(api_key)
|
||||
@client = MessagebusRubyApi::Client.new(AppConfig[:messagebus_api_key])
|
||||
puts "yayayayaayayay"
|
||||
@client = MessagebusRubyApi::Client.new(api_key)
|
||||
puts @client.inspect
|
||||
|
||||
end
|
||||
|
||||
attr_accessor :settings
|
||||
|
|
@ -15,13 +21,18 @@ module Messagebus
|
|||
deliver(message)
|
||||
end
|
||||
|
||||
def message_parse(string)
|
||||
puts string
|
||||
string.split('<')[0]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def deliver(message)
|
||||
# here we want = {:fromEmail => message['from'].to_s}
|
||||
@client.common_info = {:fromEmail => message.from.first}
|
||||
@client.send_common_info = {:fromEmail => message.from.first, :customHeaders => {"sender"=> message['from'].to_s}}
|
||||
message.to.each do |addressee|
|
||||
m = {:toEmail => addressee, :subject => message.subject}
|
||||
m = {:toEmail => addressee, :subject => message.subject, :fromName => message_parse(message['from'].to_s)}
|
||||
|
||||
if message.multipart?
|
||||
m[:plaintextBody] = message.text_part.body.to_s if message.text_part
|
||||
|
|
@ -33,12 +44,10 @@ module Messagebus
|
|||
@client.add_message(m)
|
||||
end
|
||||
|
||||
status = @client.flush
|
||||
|
||||
if status[:failureCount] && status[:failureCount] > 0
|
||||
puts "DOHHHHHHHHHHH"
|
||||
raise "Messagebus failure. failureCount=#{failureCount}, message=#{message.inspect}"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue