go-smtp-mock
go-smtp-mock copied to clipboard
[BUG] Invalid email can be passed as argument for MAIL FROM, RCPT TO commands
New bug checklist
- [x] I have updated
smtpmock
to the latest version - [x] I have read the Contribution Guidelines
- [x] I have read the documentation
- [x] I have searched for existing GitHub issues
Bug description
Regex for validation of email works in wrong way. We can pass to MAIL FROM
, RCPT TO
invalid email, like [email protected]@b.com
. Seems when wrong email ends on valid domain it passes ([email protected]@b.com). We need to fix it and cover via tests.
Complete output when running smtpmock, including the stack trace and command used
INFO: 2022/11/18 19:20:12.419178 SMTP session started
INFO: 2022/11/18 19:20:12.419265 SMTP response: 220 Welcome
INFO: 2022/11/18 19:20:12.419533 SMTP request: EHLO gibson.biz
INFO: 2022/11/18 19:20:12.421156 SMTP response: 250 Received
INFO: 2022/11/18 19:20:12.421370 SMTP request: MAIL FROM:<[email protected]>
INFO: 2022/11/18 19:20:12.421935 SMTP response: 250 Received
INFO: 2022/11/18 19:20:12.422099 SMTP request: RCPT TO:<[email protected]@b.com>
INFO: 2022/11/18 19:20:12.422823 SMTP response: 250 Received
INFO: 2022/11/18 19:20:12.422972 SMTP request: DATA