Skip to content

Instantly share code, notes, and snippets.

@woodie
Last active December 15, 2016 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodie/363e76e589aa2b642ad320dab9b4682d to your computer and use it in GitHub Desktop.
Save woodie/363e76e589aa2b642ad320dab9b4682d to your computer and use it in GitHub Desktop.
Local mail delivery on Windows Server using IIS SMTP Service
# config/environments/production.rb
# Local mail delivery using IIS SMTP Service
require 'shim/mail_message' # fix line endings
config.action_mailer.delivery_method = :file
config.action_mailer.file_settings = { location: "#{ENV['SystemDrive']}/InetPub/MailRoot/Pickup" }
# lib/shim/mail_message.rb
# Patch Mail::Message to enforce proper line-endings for Windows IIS file-type delivery.
module Mail
class Message
alias :_encoded :encoded
def encoded
_encoded.encode(universal_newline: true)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment