Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not require the SMTPUTF8 extension when not needed #146

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Also check smtputf8 for submitted messages or when in pedantic mode
lmeunier committed Mar 31, 2024
commit c075a8cd8bb116dc1b8ecae9880a70656d362714
7 changes: 5 additions & 2 deletions smtpserver/server.go
Original file line number Diff line number Diff line change
@@ -1804,9 +1804,8 @@ func (c *conn) cmdData(p *parser) {
}

// Now that we have all the whole message (envelope + data), we can check if the SMTPUTF8 extension is required.
// The check happens only when the client required the SMTPUTF8 extension.
var part *message.Part
if c.smtputf8 {
if c.smtputf8 || c.submission || mox.Pedantic {
// Try to parse the message.
// Do nothing if something bad happen during Parse and Walk, just keep the current value for c.msgsmtputf8.
p, err := message.Parse(c.log.Logger, true, dataFile)
@@ -1822,6 +1821,10 @@ func (c *conn) cmdData(p *parser) {
c.log.Debug("SMTPUTF8 flag changed", slog.Bool("received SMTPUTF8", c.smtputf8), slog.Bool("evaluated SMTPUTF8", c.msgsmtputf8))
}
}
if !c.smtputf8 && c.msgsmtputf8 && mox.Pedantic {
metricSubmission.WithLabelValues("missingsmtputf8").Inc()
xsmtpUserErrorf(smtp.C550MailboxUnavail, smtp.SeMsg6Other0, "smtputf8 extension is required but was not added to the MAIL command")
}

// Prepare "Received" header.
// ../rfc/5321:2051 ../rfc/5321:3302