mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 13:44:37 +03:00
smtpserver: allow using an "message from" address from an allowed alias as smtp mail from during submission
mail clients will use these message from addresses also for smtp mail from, so sending over smtp would fail for these cases. for the webmail and webapi they already succeeded since we just took the "message from" address as "smtp mail from" address. for issue #266 by Robby-, thanks for reporting!
This commit is contained in:
@ -1756,13 +1756,16 @@ func (c *conn) cmdMail(p *parser) {
|
||||
|
||||
// For submission, check if reverse path is allowed. I.e. authenticated account
|
||||
// must have the rpath configured. We do a check again on rfc5322.from during DATA.
|
||||
// Mail clients may use the alias address as smtp mail from address, so we allow it
|
||||
// for such aliases.
|
||||
rpathAllowed := func() bool {
|
||||
// ../rfc/6409:349
|
||||
if rpath.IsZero() {
|
||||
return true
|
||||
}
|
||||
accName, _, _, _, err := mox.LookupAddress(rpath.Localpart, rpath.IPDomain.Domain, false, false)
|
||||
return err == nil && accName == c.account.Name
|
||||
|
||||
from := smtp.NewAddress(rpath.Localpart, rpath.IPDomain.Domain)
|
||||
return mox.AllowMsgFrom(c.account.Name, from)
|
||||
}
|
||||
|
||||
if !c.submission && !rpath.IPDomain.Domain.IsZero() {
|
||||
|
Reference in New Issue
Block a user