Skip to content
Extraits de code Groupes Projets
Valider 85e51a6d rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

wip

parent f4bfa227
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -77,6 +77,9 @@ gem 'SystemTimer', '1.2.1', :platforms => :ruby_18 ...@@ -77,6 +77,9 @@ gem 'SystemTimer', '1.2.1', :platforms => :ruby_18
gem 'hoptoad_notifier' gem 'hoptoad_notifier'
gem 'newrelic_rpm', :require => false gem 'newrelic_rpm', :require => false
#mail
gem 'messagebus_ruby_api', :git => 'https://github.com/messagebus/messagebus_ruby_api.git'
# tags # tags
gem 'acts-as-taggable-on', :git => 'git://github.com/diaspora/acts-as-taggable-on.git' gem 'acts-as-taggable-on', :git => 'git://github.com/diaspora/acts-as-taggable-on.git'
......
...@@ -56,6 +56,12 @@ GIT ...@@ -56,6 +56,12 @@ GIT
addressable (>= 2.1.1) addressable (>= 2.1.1)
eventmachine (>= 0.12.9) eventmachine (>= 0.12.9)
GIT
remote: https://github.com/messagebus/messagebus_ruby_api.git
revision: 02b3d04730f3a72f636c0b4ddbbcd660bba6a75e
specs:
messagebus_ruby_api (0.4.8)
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
...@@ -505,6 +511,7 @@ DEPENDENCIES ...@@ -505,6 +511,7 @@ DEPENDENCIES
json (= 1.4.6) json (= 1.4.6)
jwt (= 0.1.3) jwt (= 0.1.3)
linecache (= 0.43) linecache (= 0.43)
messagebus_ruby_api!
mini_magick (= 3.2) mini_magick (= 3.2)
mobile-fu mobile-fu
mock_redis mock_redis
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is # Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
Diaspora::Application.configure do Diaspora::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb # Settings specified here will take precedence over those in config/environment.rb
...@@ -17,6 +16,7 @@ Diaspora::Application.configure do ...@@ -17,6 +16,7 @@ Diaspora::Application.configure do
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log config.active_support.deprecation = :log
......
...@@ -2,36 +2,39 @@ ...@@ -2,36 +2,39 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
require File.join(Rails.root, 'lib/messagebus/mailer')
Diaspora::Application.configure do Diaspora::Application.configure do
config.action_mailer.default_url_options = {:host => AppConfig[:pod_uri].authority } config.action_mailer.default_url_options = {:host => AppConfig[:pod_uri].authority }
unless Rails.env == 'test' || AppConfig[:mailer_on] != true # unless Rails.env == 'test' || AppConfig[:mailer_on] != true
if AppConfig[:mailer_method] == "sendmail" # if AppConfig[:mailer_method] == "sendmail"
config.action_mailer.delivery_method = :sendmail # config.action_mailer.delivery_method = :sendmail
config.action_mailer.sendmail_settings = { # config.action_mailer.sendmail_settings = {
:location => AppConfig[:sendmail_location] # :location => AppConfig[:sendmail_location]
} # }
else # else
config.action_mailer.delivery_method = :smtp # config.action_mailer.delivery_method = :smtp
if AppConfig[:smtp_authentication] == "none" # if AppConfig[:smtp_authentication] == "none"
config.action_mailer.smtp_settings = { # config.action_mailer.smtp_settings = {
:address => AppConfig[:smtp_address], # :address => AppConfig[:smtp_address],
:port => AppConfig[:smtp_port], # :port => AppConfig[:smtp_port],
:domain => AppConfig[:smtp_domain], # :domain => AppConfig[:smtp_domain],
:enable_starttls_auto => false, # :enable_starttls_auto => false,
:openssl_verify_mode => AppConfig[:smtp_openssl_verify_mode] # :openssl_verify_mode => AppConfig[:smtp_openssl_verify_mode]
} # }
else # else
config.action_mailer.smtp_settings = { # config.action_mailer.smtp_settings = {
:address => AppConfig[:smtp_address], # :address => AppConfig[:smtp_address],
:port => AppConfig[:smtp_port], # :port => AppConfig[:smtp_port],
:domain => AppConfig[:smtp_domain], # :domain => AppConfig[:smtp_domain],
:authentication => AppConfig[:smtp_authentication], # :authentication => AppConfig[:smtp_authentication],
:user_name => AppConfig[:smtp_username], # :user_name => AppConfig[:smtp_username],
:password => AppConfig[:smtp_password], # :password => AppConfig[:smtp_password],
:enable_starttls_auto => AppConfig[:smtp_starttls_auto], # :enable_starttls_auto => AppConfig[:smtp_starttls_auto],
:openssl_verify_mode => AppConfig[:smtp_openssl_verify_mode] # :openssl_verify_mode => AppConfig[:smtp_openssl_verify_mode]
} # }
end # end
end # end
end # end
config.action_mailer.delivery_method = Messagebus::Mailer.new('986071AEF15FBE380E75A9805C77E733')
end end
module Messagebus
class Mailer
def initialize(api_key)
@client = MessagebusRubyApi::Client.new(api_key)
end
attr_accessor :settings
def new(*settings)
self
end
def deliver!(message)
deliver(message)
end
private
def deliver(message)
puts "dslkfjasd;lfkjasd;lkfjasd;lkfjasd;lkfjasd;lfjkasd;lkfjasd;lfkjasd;lfkjasd;lkfjas;ldkfj;alsdkjf;lasdjkf;lasdkjf;alsdjkfls"
@client.common_info = {:fromEmail => message.from.first}
message.to.each do |addressee|
m = {:toEmail => addressee, :subject => message.subject}
if message.multipart?
m[:plaintextBody] = message.text_part.body.to_s if message.text_part
m[:htmlBody] = message.html_part.body.to_s if message.html_part
else
m[:plaintextBody] = message.body.to_s
end
@client.add_message(m)
end
status = @client.flush
if status[:failureCount] && status[:failureCount] > 0
raise "Messagebus failure. failureCount=#{failureCount}, message=#{message.inspect}"
end
end
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter