mirror of
https://github.com/mjl-/mox.git
synced 2025-01-14 01:06:27 +03:00
when rejecting a message, add field "msgfrom" to the logging line
This commit is contained in:
parent
b0641a1901
commit
eb26e9b921
2 changed files with 7 additions and 1 deletions
|
@ -102,11 +102,17 @@ func (a Address) IsZero() bool {
|
||||||
// formatted with non-ASCII characters. If localpart has non-ASCII characters,
|
// formatted with non-ASCII characters. If localpart has non-ASCII characters,
|
||||||
// they are returned regardless of smtputf8.
|
// they are returned regardless of smtputf8.
|
||||||
func (a Address) Pack(smtputf8 bool) string {
|
func (a Address) Pack(smtputf8 bool) string {
|
||||||
|
if a.IsZero() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return a.Localpart.String() + "@" + a.Domain.XName(smtputf8)
|
return a.Localpart.String() + "@" + a.Domain.XName(smtputf8)
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns the address in string form with non-ASCII characters.
|
// String returns the address in string form with non-ASCII characters.
|
||||||
func (a Address) String() string {
|
func (a Address) String() string {
|
||||||
|
if a.IsZero() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return a.Localpart.String() + "@" + a.Domain.Name()
|
return a.Localpart.String() + "@" + a.Domain.Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2193,7 +2193,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("incoming message rejected", mlog.Field("reason", a.reason))
|
log.Info("incoming message rejected", mlog.Field("reason", a.reason), mlog.Field("msgfrom", msgFrom))
|
||||||
metricDelivery.WithLabelValues("reject", a.reason).Inc()
|
metricDelivery.WithLabelValues("reject", a.reason).Inc()
|
||||||
c.setSlow(true)
|
c.setSlow(true)
|
||||||
addError(rcptAcc, a.code, a.secode, a.userError, a.errmsg)
|
addError(rcptAcc, a.code, a.secode, a.userError, a.errmsg)
|
||||||
|
|
Loading…
Reference in a new issue