Maildrop turn on

maildrop is a mail delivery agent that can be used to filter and deliver email messages. To turn it on, you'll need to configure it to run automatically when you start your system. Here are the general steps:

On Linux systems:

  1. Install maildrop: If you haven't already, install maildrop on your system. The package name may vary depending on your distribution. For example, on Ubuntu/Debian, you can use sudo apt-get install maildrop.
  2. Configure maildrop: Edit the /etc/maildrop.conf file to specify the email account(s) you want to use with maildrop. You can add the following lines to the file:
    
    # Set the email account to use
    ACCOUNT [email protected]

Set the email password

PASSWORD mypassword

Set the email server

SERVER mail.example.com

Replace `[email protected]`, `mypassword`, and `mail.example.com` with your actual email account information.
3. **Create a maildrop filter**: Create a file in the `/etc/maildrop/filters` directory (or a subdirectory) with a `.filter` extension. For example, you can create a file called `myfilter.filter`. In this file, you can specify the rules for filtering and delivering email messages. For example:
```bash
# Filter email messages
if ( $header : contains "spam" )
  then deliver "/dev/null"
else
  deliver "[email protected]"

This filter will deliver email messages that contain the word "spam" to /dev/null (i.e., delete them), and deliver all other email messages to your email account. 4. Enable maildrop: Create a systemd service file to enable maildrop to run automatically when you start your system. Create a file called /etc/systemd/system/maildrop.service with the following contents:

[Unit]
Description=Maildrop Service
After=network.target

[Service]
User=root
ExecStart=/usr/bin/maildrop -f /etc/maildrop.conf
Restart=always

[Install]
WantedBy=multi-user.target
  1. Reload systemd daemon: Reload the systemd daemon to pick up the new service file: sudo systemctl daemon-reload.
  2. Start and enable maildrop service: Start the maildrop service and enable it to start automatically when you boot your system: sudo systemctl start maildrop and sudo systemctl enable maildrop.

On macOS (with Homebrew):

  1. Install maildrop: Install maildrop using Homebrew: brew install maildrop.
  2. Configure maildrop: Edit the ~/.maildrop file to specify the email account(s) you want to use with maildrop. You can add the following lines to the file:
    
    # Set the email account to use
    ACCOUNT [email protected]

Set the email password

PASSWORD mypassword

Set the email server

SERVER mail.example.com

Replace `[email protected]`, `mypassword`, and `mail.example.com` with your actual email account information.
3. **Create a maildrop filter**: Create a file in the `~/.maildrop/filters` directory (or a subdirectory) with a `.filter` extension. For example, you can create a file called `myfilter.filter`. In this file, you can specify the rules for filtering and delivering email messages. For example:
```bash
# Filter email messages
if ( $header : contains "spam" )
  then deliver "/dev/null"
else
  deliver "[email protected]"

This filter will deliver email messages that contain the word "spam" to /dev/null (i.e., delete them), and deliver all other email messages to your email account. 4. Enable maildrop: Add the following line to your shell configuration file (e.g., ~/.bashrc or ~/.zshrc) to enable maildrop to run automatically when you start your shell:

export MAILDROP_FILTERS=~/.maildrop/filters
  1. Restart your shell: Restart your shell to pick up the new configuration: exec $SHELL.

That's it! Maildrop should now be running and filtering your email messages according to your custom filter rules.