mirror of
https://github.com/axllent/mailpit.git
synced 2025-08-15 20:13:16 +02:00
Chore: Stricter SMTP 'MAIL FROM' & 'RCPT TO' handling (#409)
* Update lib.go: Changing `mailFromRE` and `rcptToRE` regex I don't know how to rebase so I started from scratch ;-) 2 changes compared to what you said at https://github.com/axllent/mailpit/pull/406#issuecomment-2540350780 * I did the same for `rcptToRE` * I replaced the `*` quantifier with `+`, for consistency * Update lib.go * Allow valid empty MAIL FROM value --------- Co-authored-by: Ralph Slooten <axllent@gmail.com>
This commit is contained in:
@@ -27,8 +27,8 @@ import (
|
||||
var (
|
||||
// Debug `true` enables verbose logging.
|
||||
Debug = false
|
||||
rcptToRE = regexp.MustCompile(`[Tt][Oo]:\s?<(.+)>`)
|
||||
mailFromRE = regexp.MustCompile(`[Ff][Rr][Oo][Mm]:\s?<(.*)>(\s(.*))?`) // Delivery Status Notifications are sent with "MAIL FROM:<>"
|
||||
rcptToRE = regexp.MustCompile(`[Tt][Oo]: ?<([^<>\v]+)>( |$)(.*)?`)
|
||||
mailFromRE = regexp.MustCompile(`[Ff][Rr][Oo][Mm]: ?<(|[^<>\v]+)>( |$)(.*)?`) // Delivery Status Notifications are sent with "MAIL FROM:<>"
|
||||
|
||||
// extract mail size from 'MAIL FROM' parameter
|
||||
mailFromSizeRE = regexp.MustCompile(`(?U)(^| |,)[Ss][Ii][Zz][Ee]=(.*)($|,| )`)
|
||||
|
Reference in New Issue
Block a user