{"record":{"id":"d58976936cb4d248","repo":"padrino/padrino-framework","slug":"to-use-mailers-on-windows-you-must-set-a-delivery","errorCode":null,"errorMessage":"To use mailers on Windows you must set a :delivery_method, see http://padrinorb.com/guides/features/padrino-mailer/#configuration","messagePattern":"To use mailers on Windows you must set a :delivery_method, see http://padrinorb\\.com/guides/features/padrino-mailer/#configuration","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"padrino-mailer/lib/padrino-mailer/helpers.rb","lineNumber":153,"sourceCode":"        #\n        def email(mail_attributes = {}, &block)\n          message = _padrino_mailer::Message.new(self)\n          message.delivery_method(*delivery_settings)\n          message.instance_eval(&block) if block_given?\n          mail_attributes = mailer_defaults.merge(mail_attributes) if respond_to?(:mailer_defaults)\n          mail_attributes.each_pair { |k, v| message.method(k).call(v) }\n          message.deliver\n        end\n\n        private\n\n        ##\n        # Returns the parsed delivery method options.\n        #\n        def delivery_settings\n          @_delivery_setting ||= begin\n            if Gem.win_platform? && !respond_to?(:delivery_method)\n              raise 'To use mailers on Windows you must set a :delivery_method, see http://padrinorb.com/guides/features/padrino-mailer/#configuration'\n            end\n\n            return [:sendmail, { location: `which sendmail`.chomp }] unless respond_to?(:delivery_method)\n            return [delivery_method.keys[0], delivery_method.values[0]] if delivery_method.is_a?(Hash)\n            return [delivery_method, {}] if delivery_method.is_a?(Symbol)\n            [nil, {}]\n          end\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":135,"sourceCodeEnd":166,"githubUrl":"https://github.com/padrino/padrino-framework/blob/167044f3d56b2bce12f943eb826fdb0b0ea94375/padrino-mailer/lib/padrino-mailer/helpers.rb#L135-L166","documentation":"delivery_settings computes how mail is sent. On Unix with no explicit setting it falls back to sendmail via which sendmail. Windows has no sendmail binary, so when Gem.win_platform? is true and no :delivery_method setting exists (the settings object does not respond_to?(:delivery_method)), Padrino raises and points you at the configuration guide.","triggerScenarios":"Booting or delivering mail on Windows (including JRuby on Windows or Windows CI runners) when neither the app nor the mailer sets set :delivery_method, ...; any environment where Gem.win_platform? reports true and the sendmail default cannot apply.","commonSituations":"Developers switching from macOS or Linux to a Windows workstation; CI suites running on windows images; deploying to Windows servers without an SMTP relay configured in the app.","solutions":["Set an explicit delivery method in app/mailers.rb or the app class: set :delivery_method, :smtp => { address: 'smtp.example.com', port: 587, user_name: ENV['SMTP_USER'], password: ENV['SMTP_PASS'], authentication: :plain, enable_starttls_auto: true }","For tests and CI use set :delivery_method, :test so nothing real is sent","If you see this on Linux, check that nothing is forcing Gem.win_platform? true (cross-compile settings, platform overrides)"],"exampleFix":"# before — app/mailers.rb sets nothing; delivering on Windows raises\n\n# after — app/mailers.rb\nset :delivery_method, :smtp => {\n  address: 'smtp.example.com', port: 587,\n  user_name: ENV['SMTP_USER'], password: ENV['SMTP_PASS'],\n  authentication: :plain, enable_starttls_auto: true\n}","handlingStrategy":"validation","validationCode":"if Gem.win_platform? && !respond_to?(:delivery_method)\n  raise 'configure set :delivery_method before delivering mail'\nend","typeGuard":"def mail_delivery_configured?\n  respond_to?(:delivery_method) && !delivery_method.nil?\nend","tryCatchPattern":null,"preventionTips":["Set an explicit :delivery_method per environment (smtp in production, test in CI)","Do not rely on the sendmail default in apps that must run on Windows","Keep SMTP credentials in ENV variables, never in the repo"],"tags":["padrino-mailer","windows","delivery-method","smtp","platform"],"backgroundTag":"missing-mail-transport-config","analyzedSha":"167044f3d56b2bce12f943eb826fdb0b0ea94375","analyzedAt":"2026-08-23T12:41:41.049Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}