mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 15:04:36 +03:00
Also check smtputf8 for submitted messages or when in pedantic mode
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user