Marten SMTP Emailing provides an SMTP backend that can be used with Marten web framework's emailing system.
Simply add the following entry to your project's shard.yml:
dependencies:
marten_smtp_emailing:
github: martenframework/marten-smtp-emailingAnd run shards install afterward.
First, add the following requirement to your project's src/project.cr file:
require "marten_smtp_emailing"You can then configure your project to use the SMTP backend by setting the corresponding configuration option as follows:
Marten.configure do |config|
config.emailing.backend = MartenSMTPEmailing::Backend.new
endBy default, the backend will attempt to deliver emails to an SMTP server running on localhost and listening on the standard SMTP port (25). If you need to, you can change these backend properties at initialization time:
Marten.configure do |config|
config.emailing.backend = MartenSMTPEmailing::Backend.new(
host: "localhost",
port: 25,
helo_domain: "localhost",
use_tls: true,
username: nil,
password: nil
)
endMorgan Aubert (@ellmetha) and contributors.
MIT. See LICENSE for more details.