Skip to content

Commit

Permalink
Allow catch-all addresses when validating must match sender
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Apr 28, 2024
1 parent 20a74e7 commit a93c792
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/smtp/src/inbound/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ impl<T: SessionStream> Session<T> {
if !self.data.authenticated_as.is_empty()
&& self.params.auth_match_sender
&& (self.data.authenticated_as != address_lcase
&& !self.data.authenticated_emails.contains(&address_lcase))
&& !self.data.authenticated_emails.iter().any(|e| {
e == &address_lcase || (e.starts_with('@') && address_lcase.ends_with(e))
}))
{
return self
.write(b"501 5.5.4 You are not allowed to send from this address.\r\n")
Expand Down

1 comment on commit a93c792

@moeffju
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏🏼 this is gonna be super useful, thank you!

Please sign in to comment.