Removed term 'whitelist'

This commit is contained in:
Philip (a-0) 2022-09-02 14:54:57 +02:00
parent 19ebd247f7
commit 5ac1425b44
4 changed files with 7 additions and 7 deletions

View file

@ -11,7 +11,7 @@ Just invite the bot accounts to the rooms they should post in, and enter the roo
**Hint:** Encryption works flawlessly when the bot account has logged in once before, there can be minor issues otherwise. You can just do a dry run of matrixmailer with the clients already specified in the configuration file to do that. **Hint:** Encryption works flawlessly when the bot account has logged in once before, there can be minor issues otherwise. You can just do a dry run of matrixmailer with the clients already specified in the configuration file to do that.
## How it works ## How it works
matrixmailer spins up a minimalistic SMTP server which receives any email (except you use the whitelisting feature, see sample configs), matrixmailer spins up a minimalistic SMTP server which receives any email (except you use the receiver_allowlist feature, see sample configs),
## Contributing ## Contributing
Feel free to join #matrixmailer:a-0.me to ask questions and discuss, or even to just leave feedback! Feel free to join #matrixmailer:a-0.me to ask questions and discuss, or even to just leave feedback!

View file

@ -1,6 +1,6 @@
# This config file will make matrixmailer # This config file will make matrixmailer
# - Bind the SMTP server on 1.2.3.4:2525 # - Bind the SMTP server on 1.2.3.4:2525
# - Reject receiving mail that is not sent to one of the email addresses in the whitelist # - Reject receiving mail that is not sent to one of the allowed receiving email addresses in the
# - Forward all received mails # - Forward all received mails
# - that were sent to warning@mydomain.com to the "warning" room using "@secondbot:example.com" # - that were sent to warning@mydomain.com to the "warning" room using "@secondbot:example.com"
# - that were sent to critical@mydomain.com to the "important" room using "@firstbot:example.com" # - that were sent to critical@mydomain.com to the "important" room using "@firstbot:example.com"
@ -9,7 +9,7 @@
--- ---
bind_address: "1.2.3.4" bind_address: "1.2.3.4"
bind_port: "2525" bind_port: "2525"
receiver_whitelist: allowed_receivers:
- "warning@mydomain.com" - "warning@mydomain.com"
- "critical@mydomain.com" - "critical@mydomain.com"
clients: clients:

View file

@ -6,7 +6,7 @@ pub struct Config {
pub bind_address: Option<String>, pub bind_address: Option<String>,
pub bind_port: Option<String>, pub bind_port: Option<String>,
pub client_storage_path: Option<String>, pub client_storage_path: Option<String>,
pub receiver_whitelist: Option<Vec<String>>, pub allowed_receivers: Option<Vec<String>>,
pub clients: Vec<ClientConfig>, pub clients: Vec<ClientConfig>,
pub mappings: Vec<Mapping>, pub mappings: Vec<Mapping>,
} }

View file

@ -21,7 +21,7 @@ async fn main() {
let service = SmtpService::create(format!("{}:{}", config.bind_address.unwrap(), config.bind_port.unwrap()).parse().unwrap(), "matrixmailer".into(), let service = SmtpService::create(format!("{}:{}", config.bind_address.unwrap(), config.bind_port.unwrap()).parse().unwrap(), "matrixmailer".into(),
Arc::new(ToMatrixConverter { Arc::new(ToMatrixConverter {
receiver_whitelist: config.receiver_whitelist, allowed_receivers: config.allowed_receivers,
matrix_clients: clients, matrix_clients: clients,
mappings: config.mappings, mappings: config.mappings,
})); }));
@ -32,7 +32,7 @@ struct ToMatrixConverter {
// If None, any incoming mail will be accepted. // If None, any incoming mail will be accepted.
// If Some(x), any mail with a mail address in x in its recipients will be accepted. // If Some(x), any mail with a mail address in x in its recipients will be accepted.
// "Not accepted" means the sender will get a "RCPT failed" reply // "Not accepted" means the sender will get a "RCPT failed" reply
receiver_whitelist: Option<Vec<String>>, allowed_receivers: Option<Vec<String>>,
matrix_clients: Vec<Client>, matrix_clients: Vec<Client>,
mappings: Vec<Mapping>, mappings: Vec<Mapping>,
} }
@ -41,7 +41,7 @@ struct ToMatrixConverter {
impl Handler for ToMatrixConverter { impl Handler for ToMatrixConverter {
// Checks whether receipient is local (and the mail should thus be handled by this service) // Checks whether receipient is local (and the mail should thus be handled by this service)
async fn recipient_local(&self, recipient: &Mailbox) -> bool { async fn recipient_local(&self, recipient: &Mailbox) -> bool {
match &self.receiver_whitelist { match &self.allowed_receivers {
None => true, None => true,
Some(list) => { Some(list) => {
let addr = format!("{}@{}", recipient.local, recipient.domain.0); let addr = format!("{}@{}", recipient.local, recipient.domain.0);