mirror of
https://github.com/mjl-/mox.git
synced 2025-03-26 03:25:50 +03:00
Also check smtputf8 for submitted messages or when in pedantic mode
This commit is contained in:
parent
c02328f881
commit
c075a8cd8b
1 changed files with 5 additions and 2 deletions
|
@ -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.
|
// 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
|
var part *message.Part
|
||||||
if c.smtputf8 {
|
if c.smtputf8 || c.submission || mox.Pedantic {
|
||||||
// Try to parse the message.
|
// Try to parse the message.
|
||||||
// Do nothing if something bad happen during Parse and Walk, just keep the current value for c.msgsmtputf8.
|
// 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)
|
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))
|
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.
|
// Prepare "Received" header.
|
||||||
// ../rfc/5321:2051 ../rfc/5321:3302
|
// ../rfc/5321:2051 ../rfc/5321:3302
|
||||||
|
|
Loading…
Reference in a new issue