Skip to content

Commit

Permalink
Merge branch 'master' into feature/seed-via-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
DenuxPlays authored Dec 8, 2024
2 parents a074624 + 1737be8 commit 31376c9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ backtrace_printer = { version = "1.3.0" }
# cli
clap = { version = "4.4.7", features = ["derive"], optional = true }
colored = "2"
reqwest = { version = "0.12.7", features = ["json"] }
reqwest = { version = "0.12.7", features = [
"charset",
"http2",
"json",
"macos-system-configuration",
"rustls-tls",
], default-features = false }


sea-orm = { version = "1.1.0", features = [
Expand Down
12 changes: 7 additions & 5 deletions loco-new/base_template/config/development.yaml.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ server:
host: http://localhost
# Out of the box middleware configuration. to disable middleware you can changed the `enable` field to `false` of comment the middleware block
middlewares:
{%- if settings.asset %}
{%- if settings.asset.kind == "server" %}
{%- if settings.asset %}
{%- if settings.asset.kind == "server" %}
static:
enable: true
must_exist: true
Expand All @@ -32,7 +32,7 @@ server:
uri: "/static"
path: "assets/static"
fallback: "assets/static/404.html"
{%- elif settings.asset.kind == "client" %}
{%- elif settings.asset.kind == "client" %}
static:
enable: true
must_exist: true
Expand All @@ -42,9 +42,9 @@ server:
path: "frontend/dist"
fallback: "frontend/dist/index.html"
{%- endif -%}

{%- endif -%}

{%- if settings.background%}

# Worker Configuration
Expand Down Expand Up @@ -83,6 +83,8 @@ mailer:
# auth:
# user:
# password:
# Override the SMTP hello name (default is the machine's hostname)
# hello_name:
{%- endif %}

# Initializers Configuration
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ pub struct SmtpMailer {
pub secure: bool,
/// Auth SMTP server
pub auth: Option<MailerAuth>,
/// Optional EHLO client ID instead of hostname
pub hello_name: Option<String>,
}

/// Authentication details for the mailer
Expand Down
9 changes: 7 additions & 2 deletions src/mailer/email_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
//! sending emails with options like sender, recipient, subject, and content.
use lettre::{
message::MultiPart, transport::smtp::authentication::Credentials, AsyncTransport, Message,
Tokio1Executor, Transport,
message::MultiPart,
transport::smtp::{authentication::Credentials, extension::ClientId},
AsyncTransport, Message, Tokio1Executor, Transport,
};
use tracing::error;

Expand Down Expand Up @@ -60,6 +61,10 @@ impl EmailSender {
.credentials(Credentials::new(auth.user.clone(), auth.password.clone()));
}

if let Some(hello_name) = config.hello_name.as_ref() {
email_builder = email_builder.hello_name(ClientId::Domain(hello_name.clone()));
}

Ok(Self {
transport: EmailTransport::Smtp(email_builder.build()),
})
Expand Down

0 comments on commit 31376c9

Please sign in to comment.