fix(GODT-2617): Validate user can send from the SMTP sender address

https://github.com/ProtonMail/go-proton-api/pull/126
This commit is contained in:
Leander Beernaert
2023-11-15 14:11:28 +01:00
parent 1cafbfcaaa
commit ea1c2534df
5 changed files with 79 additions and 5 deletions

View File

@ -17,9 +17,24 @@
package smtp
import "errors"
import (
"errors"
"fmt"
)
var ErrInvalidRecipient = errors.New("invalid recipient")
var ErrInvalidReturnPath = errors.New("invalid return path")
var ErrNoSuchUser = errors.New("no such user")
var ErrTooManyErrors = errors.New("too many failed requests, please try again later")
type ErrCanNotSendOnAddress struct {
address string
}
func NewErrCanNotSendOnAddress(address string) *ErrCanNotSendOnAddress {
return &ErrCanNotSendOnAddress{address: address}
}
func (e ErrCanNotSendOnAddress) Error() string {
return fmt.Sprintf("can't send on address: %v", e.address)
}