Can set relay name
This commit is contained in:
@@ -2,6 +2,7 @@ use clap::Parser;
|
|||||||
use lettre::message::header::ContentType;
|
use lettre::message::header::ContentType;
|
||||||
use lettre::message::Mailbox;
|
use lettre::message::Mailbox;
|
||||||
use lettre::{Message, SmtpTransport, Transport};
|
use lettre::{Message, SmtpTransport, Transport};
|
||||||
|
use lettre::transport::smtp::extension::ClientId;
|
||||||
|
|
||||||
/// Simple mail sender
|
/// Simple mail sender
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
@@ -50,6 +51,10 @@ struct Args {
|
|||||||
/// Disable TLS
|
/// Disable TLS
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
disable_tls: bool,
|
disable_tls: bool,
|
||||||
|
|
||||||
|
/// Relay name
|
||||||
|
#[arg(long, default_value = "mail-out.mail.internal")]
|
||||||
|
smtp_relay_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@@ -81,6 +86,7 @@ fn main() {
|
|||||||
true => SmtpTransport::builder_dangerous(&args.smtp_domain),
|
true => SmtpTransport::builder_dangerous(&args.smtp_domain),
|
||||||
false => SmtpTransport::relay(&args.smtp_domain).unwrap(),
|
false => SmtpTransport::relay(&args.smtp_domain).unwrap(),
|
||||||
};
|
};
|
||||||
|
mailer = mailer.hello_name(ClientId::Domain(args.smtp_relay_name));
|
||||||
if let Some(port) = args.smtp_port {
|
if let Some(port) = args.smtp_port {
|
||||||
mailer = mailer.port(port);
|
mailer = mailer.port(port);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user