-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update lib.go: Changing mailFromRE
and rcptToRE
regex
#409
Conversation
I don't know how to rebase so I started from scratch ;-) 2 changes compared to what you said at axllent#406 (comment) * I did the same for `rcptToRE` * I replaced the `*` quantifier with `+`, for consistency
One more question: This is the first time that I'm seeing the |
@@ -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]+)>( |$)(.*)?`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The closing ( |$)(.*)?
should be just ?$
as we want to account for one possible space, and then the end of the line. Unlike MAIL FROM
, I am not aware of any other arguments that are allowed to be passed to RCPT TO
(unless you know something I don't?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTIFY
and ORCPT
, see https://datatracker.ietf.org/doc/html/rfc3461#section-4.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! OK, leave rcptToRE
as you had it, we just ignore any parameters 👍
All good. Rebasing is like taking the changes from another branch and then "merging" your changes over the to of them, but in your current branch. Sometimes with mixed results... so no problem, whatever works :)
The other one I came across a couple of days ago is I have added a comment regarding the updated
On that note, do you know how to test in go? Running |
server/smtpd/lib.go
Outdated
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:<>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh found it, to allow an empty value: add a pipe symbol at the start of <(|[^<>\v]+)>
so we allow nothing OR what you have - seems to work 🥳
I was still waiting on the final change to allow empty |
This has now been released in v1.21.7. Thanks for your efforts! |
Just wanted to take care of the rest today, but you already fixed it :-) About |
The SMTPD supports As for documenting it what it validates and what it doesn't in this regard, I'd argue it's not important and just adds lots of words to the documentation. Mailpit was been widely used for testing in the last two+ years, and only this last week did an issue arise because of the |
FYI, I was curious, so I took a closer look at the 3 SMTP clients I have at hand: Thunderbird 115.14.0:
Exim 4.96:
Postfix 3.7.11:
|
That's really good to know, thank you. Interesting how Thunderbird provides two arguments, which answers another thing I wasn't sure about - how they are strung together. I assumed it was either a space or a comma so I catered for both 😄 |
Multiple Keywords are separated by a space; multiple values of the same keyword are separated by comma:
And some keywords don't have values at all:
And there's also a semicolon separating the 2 parts of one value:
|
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [axllent/mailpit](https://github.com/axllent/mailpit) | patch | `v1.21.6` -> `v1.21.8` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>axllent/mailpit (axllent/mailpit)</summary> ### [`v1.21.8`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1218) [Compare Source](axllent/mailpit@v1.21.7...v1.21.8) ##### Chore - Update node dependencies - Update Go dependencies ##### Fix - **db:** Remove unused FOREIGN KEY REFERENCES in message_tags table ([#​374](axllent/mailpit#374)) ### [`v1.21.7`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1217) [Compare Source](axllent/mailpit@v1.21.6...v1.21.7) ##### Chore - Update node dependencies - Update Go dependencies - Bump Go version for automated testing - Move smtpd & pop3 modules to internal - Stricter SMTP 'MAIL FROM' & 'RCPT TO' handling ([#​409](axllent/mailpit#409)) - Display "To" details in mobile messages list - Display "From" details in message sidebar (desktop) ([#​403](axllent/mailpit#403)) ##### Fix - Ignore unsupported optional SMTP 'MAIL FROM' parameters ([#​407](axllent/mailpit#407)) - Prevent splitting multi-byte characters in message snippets ([#​404](axllent/mailpit#404)) ##### Testing - Add smtpd tests </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS42NC4wIiwidXBkYXRlZEluVmVyIjoiMzkuNzUuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
I don't know how to rebase so I started from scratch ;-)
Most important change is
( |$)
in the middle, this removes the nested parentheses in the end; and therefore the entire regex is more readable I think (if a regex can be readable at all g...)Anyway, this now fails on
foo>@example.com
.