forked from e621ng/e621ng
Send mail using mailgun
This commit is contained in:
parent
23f1a6c1c5
commit
3d7f1532f2
3
Gemfile
3
Gemfile
@ -48,6 +48,9 @@ gem 'request_store'
|
||||
gem 'elasticsearch-model'
|
||||
gem 'elasticsearch-rails'
|
||||
|
||||
|
||||
gem 'mailgun-ruby'
|
||||
|
||||
# needed for looser jpeg header compat
|
||||
gem 'ruby-imagespec', :require => "image_spec", :git => "https://github.com/r888888888/ruby-imagespec.git", :branch => "exif-fixes"
|
||||
|
||||
|
13
Gemfile.lock
13
Gemfile.lock
@ -186,6 +186,8 @@ GEM
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
mailgun-ruby (1.2.0)
|
||||
rest-client (~> 2.0.2)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
mechanize (2.7.6)
|
||||
@ -229,6 +231,7 @@ GEM
|
||||
net-sftp (2.1.2)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (5.2.0)
|
||||
netrc (0.11.0)
|
||||
newrelic_rpm (6.5.0.357)
|
||||
nio4r (2.5.1)
|
||||
nokogiri (1.10.4)
|
||||
@ -304,6 +307,15 @@ GEM
|
||||
responders (3.0.0)
|
||||
actionpack (>= 5.0)
|
||||
railties (>= 5.0)
|
||||
rest-client (2.0.2)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rest-client (2.0.2-x64-mingw32)
|
||||
ffi (~> 1.9)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
retriable (3.1.2)
|
||||
ruby-vips (2.0.14)
|
||||
ffi (~> 1.9)
|
||||
@ -431,6 +443,7 @@ DEPENDENCIES
|
||||
httparty
|
||||
jquery-rails
|
||||
listen
|
||||
mailgun-ruby
|
||||
mechanize
|
||||
memoist
|
||||
minitest-ci
|
||||
|
@ -3,10 +3,11 @@ module Maintenance
|
||||
class EmailConfirmationMailer < ActionMailer::Base
|
||||
add_template_helper ApplicationHelper
|
||||
add_template_helper UsersHelper
|
||||
default :from => Danbooru.config.mail_from_addr, :content_type => "text/html"
|
||||
|
||||
def confirmation(user)
|
||||
@user = user
|
||||
mail(:to => @user.email, :subject => "#{Danbooru.config.app_name} account confirmation", :from => Danbooru.config.contact_email)
|
||||
mail(:to => @user.email, :subject => "#{Danbooru.config.app_name} account confirmation")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,12 @@
|
||||
module Maintenance
|
||||
module User
|
||||
class LoginReminderMailer < ActionMailer::Base
|
||||
default :from => Danbooru.config.mail_from_addr, :content_type => "text/html"
|
||||
|
||||
def notice(user)
|
||||
@user = user
|
||||
if user.email.present?
|
||||
mail(:to => user.email, :subject => "#{Danbooru.config.app_name} login reminder", :from => Danbooru.config.contact_email)
|
||||
mail(:to => user.email, :subject => "#{Danbooru.config.app_name} login reminder")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,12 @@
|
||||
module Maintenance
|
||||
module User
|
||||
class PasswordResetMailer < ActionMailer::Base
|
||||
default :from => Danbooru.config.mail_from_addr, :content_type => "text/html"
|
||||
|
||||
def reset_request(user, nonce)
|
||||
@user = user
|
||||
@nonce = nonce
|
||||
mail(:to => @user.email, :subject => "#{Danbooru.config.app_name} password reset", :from => Danbooru.config.contact_email)
|
||||
mail(:to => @user.email, :subject => "#{Danbooru.config.app_name} password reset")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
class UserMailer < ActionMailer::Base
|
||||
add_template_helper ApplicationHelper
|
||||
add_template_helper UsersHelper
|
||||
default :from => Danbooru.config.contact_email, :content_type => "text/html"
|
||||
default :from => Danbooru.config.mail_from_addr, :content_type => "text/html"
|
||||
|
||||
def dmail_notice(dmail)
|
||||
@dmail = dmail
|
||||
|
@ -767,6 +767,18 @@ fart'
|
||||
"zDMSATq0W3hmA5p3rKTgD"
|
||||
end
|
||||
|
||||
def mailgun_api_key
|
||||
''
|
||||
end
|
||||
|
||||
def mailgun_domain
|
||||
''
|
||||
end
|
||||
|
||||
def mail_from_addr
|
||||
'noreply@localhost'
|
||||
end
|
||||
|
||||
# impose additional requirements to create tag aliases and implications
|
||||
def strict_tag_requirements
|
||||
true
|
||||
|
@ -62,6 +62,12 @@ Rails.application.configure do
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
config.action_mailer.delivery_method = :mailgun
|
||||
config.action_mailer.mailgun_settings = {
|
||||
api_key: Danbooru.config.mailgun_api_key,
|
||||
domain: Danbooru.config.mailgun_domain
|
||||
}
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
Loading…
Reference in New Issue
Block a user