added first true commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+253
@@ -0,0 +1,253 @@
|
||||
|
||||
**Replace `example.com` with your actual domain**
|
||||
**Replace `YOUR_PUBLIC_IP` with your mail server's public IP address**
|
||||
|
||||
---
|
||||
|
||||
## Required DNS Records
|
||||
|
||||
### 1. MX Record (Mail Exchange)
|
||||
```
|
||||
Type: MX
|
||||
Name: @
|
||||
Content: mail.example.com
|
||||
Priority: 10
|
||||
Proxy: DNS only (gray cloud)
|
||||
TTL: Auto
|
||||
```
|
||||
|
||||
### 2. A Record (Mail Server)
|
||||
```
|
||||
Type: A
|
||||
Name: mail
|
||||
Content: YOUR_PUBLIC_IP
|
||||
TTL: Auto
|
||||
Proxy: DNS only (gray cloud)
|
||||
```
|
||||
|
||||
### 3. SPF Record (Sender Policy Framework)
|
||||
```
|
||||
Type: TXT
|
||||
Name: @
|
||||
Content: v=spf1 mx ~all
|
||||
TTL: Auto
|
||||
```
|
||||
|
||||
**For stricter policy, use:**
|
||||
```
|
||||
v=spf1 mx -all
|
||||
```
|
||||
|
||||
### 4. DKIM Record (DomainKeys Identified Mail)
|
||||
```
|
||||
Type: TXT
|
||||
Name: mail._domainkey
|
||||
Content: v=DKIM1; k=rsa; p=YOUR_PUBLIC_KEY_FROM_MAIL_TXT_FILE
|
||||
TTL: Auto
|
||||
```
|
||||
|
||||
**To get your DKIM public key:**
|
||||
```bash
|
||||
cat /etc/opendkim/keys/example.com/mail.txt
|
||||
```
|
||||
|
||||
**Important:**
|
||||
- Remove quotes from the key
|
||||
- Remove line breaks (make it one continuous line)
|
||||
- Format: `v=DKIM1; k=rsa; p=MIGfMA0GCSq...`
|
||||
|
||||
### 5. DMARC Record (Email Authentication)
|
||||
```
|
||||
Type: TXT
|
||||
Name: _dmarc
|
||||
Content: v=DMARC1; p=none; rua=mailto:dmarc@example.com
|
||||
TTL: Auto
|
||||
```
|
||||
|
||||
**Policy Levels (in order of strictness):**
|
||||
- `p=none` - Monitor only (start here)
|
||||
- `p=quarantine` - Mark suspicious emails
|
||||
- `p=reject` - Reject failing emails (most strict)
|
||||
|
||||
### 6. PTR Record (Reverse DNS)
|
||||
**⚠️ This MUST be configured at your hosting provider, NOT Cloudflare**
|
||||
|
||||
Contact your VPS/hosting provider and request:
|
||||
```
|
||||
PTR for YOUR_PUBLIC_IP → mail.example.com
|
||||
```
|
||||
|
||||
Example request email:
|
||||
```
|
||||
Subject: PTR Record Configuration Request
|
||||
|
||||
Hello,
|
||||
|
||||
Please configure the reverse DNS (PTR record) for my IP address:
|
||||
IP: YOUR_PUBLIC_IP
|
||||
PTR Record: mail.example.com
|
||||
|
||||
Thank you!
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Optional But Recommended
|
||||
|
||||
### 7. Autodiscover (Easy client setup)
|
||||
```
|
||||
Type: CNAME
|
||||
Name: autodiscover
|
||||
Content: mail.example.com
|
||||
TTL: Auto
|
||||
Proxy: DNS only
|
||||
```
|
||||
|
||||
### 8. Autoconfig (Mozilla clients)
|
||||
```
|
||||
Type: CNAME
|
||||
Name: autoconfig
|
||||
Content: mail.example.com
|
||||
TTL: Auto
|
||||
Proxy: DNS only
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verification Commands
|
||||
|
||||
After adding DNS records, verify them with these commands:
|
||||
|
||||
### Check MX Record
|
||||
```bash
|
||||
dig example.com MX
|
||||
# or
|
||||
nslookup -type=MX example.com
|
||||
```
|
||||
|
||||
### Check A Record
|
||||
```bash
|
||||
dig mail.example.com A
|
||||
# or
|
||||
nslookup mail.example.com
|
||||
```
|
||||
|
||||
### Check SPF Record
|
||||
```bash
|
||||
dig example.com TXT
|
||||
# or
|
||||
nslookup -type=TXT example.com
|
||||
```
|
||||
|
||||
### Check DKIM Record
|
||||
```bash
|
||||
dig mail._domainkey.example.com TXT
|
||||
# or
|
||||
nslookup -type=TXT mail._domainkey.example.com
|
||||
```
|
||||
|
||||
### Check DMARC Record
|
||||
```bash
|
||||
dig _dmarc.example.com TXT
|
||||
# or
|
||||
nslookup -type=TXT _dmarc.example.com
|
||||
```
|
||||
|
||||
### Check PTR Record (Reverse DNS)
|
||||
```bash
|
||||
dig -x YOUR_PUBLIC_IP
|
||||
# or
|
||||
nslookup YOUR_PUBLIC_IP
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Important Notes
|
||||
|
||||
1. **Proxy Status**: Always use "DNS only" (gray cloud) for mail-related records. Never use Cloudflare proxy (orange cloud) for MX, A records pointing to mail servers, or mail-related TXT records.
|
||||
|
||||
2. **Propagation Time**: DNS changes can take 1-48 hours to fully propagate worldwide. Be patient!
|
||||
|
||||
3. **Testing Tools**: Use these to verify your setup:
|
||||
- https://www.mail-tester.com (sends test email)
|
||||
- https://mxtoolbox.com/SuperTool.aspx (DNS checker)
|
||||
- https://dmarcian.com/dmarc-inspector/ (DMARC validator)
|
||||
- https://www.dmarcanalyzer.com/dkim/dkim-check/ (DKIM validator)
|
||||
|
||||
4. **Common Mistakes**:
|
||||
- Forgetting to set PTR record at hosting provider
|
||||
- Using Cloudflare proxy on mail records
|
||||
- Not removing quotes/spaces from DKIM key
|
||||
- Typos in subdomain names (_dmarc, _domainkey)
|
||||
|
||||
5. **Priority Order**:
|
||||
- Day 1: Add MX, A, and SPF records
|
||||
- Day 2: Add DKIM record (after generating keys on server)
|
||||
- Day 3: Add DMARC with `p=none` for monitoring
|
||||
- Week 2+: Change DMARC to `p=quarantine` or `p=reject`
|
||||
|
||||
---
|
||||
|
||||
## Cloudflare Specific Settings
|
||||
|
||||
### API Mode (Optional)
|
||||
If you want to automate DNS updates via API, you'll need:
|
||||
- Your Cloudflare Zone ID
|
||||
- An API token with DNS edit permissions
|
||||
|
||||
### SSL/TLS Settings
|
||||
In Cloudflare dashboard:
|
||||
- Go to SSL/TLS → Overview
|
||||
- Set to "Full" or "Full (strict)" if you have valid certificates
|
||||
- Do NOT use "Flexible"
|
||||
|
||||
### Email Routing
|
||||
Cloudflare offers Email Routing that can forward emails. If you're running your own server, make sure:
|
||||
- Email Routing is DISABLED, or
|
||||
- Configure it to work alongside your MX records
|
||||
|
||||
---
|
||||
|
||||
## Quick Setup Checklist
|
||||
|
||||
- [ ] Add MX record pointing to mail.example.com
|
||||
- [ ] Add A record for mail.example.com with your IP
|
||||
- [ ] Add SPF TXT record
|
||||
- [ ] Generate DKIM keys on server
|
||||
- [ ] Add DKIM TXT record
|
||||
- [ ] Add DMARC TXT record (start with p=none)
|
||||
- [ ] Contact hosting provider for PTR record
|
||||
- [ ] Wait 24-48 hours for propagation
|
||||
- [ ] Test with dig/nslookup commands
|
||||
- [ ] Send test email to mail-tester.com
|
||||
- [ ] Check MXToolbox for any issues
|
||||
|
||||
---
|
||||
|
||||
## Example Complete DNS Setup
|
||||
|
||||
For domain: `example.com`
|
||||
Mail server IP: `203.0.113.50`
|
||||
|
||||
| Type | Name | Content | Priority | TTL | Proxy |
|
||||
|------|------|---------|----------|-----|-------|
|
||||
| MX | @ | mail.example.com | 10 | Auto | DNS only |
|
||||
| A | mail | 203.0.113.50 | - | Auto | DNS only |
|
||||
| TXT | @ | v=spf1 mx ~all | - | Auto | - |
|
||||
| TXT | mail._domainkey | v=DKIM1; k=rsa; p=MIGfM... | - | Auto | - |
|
||||
| TXT | _dmarc | v=DMARC1; p=none; rua=mailto:dmarc@example.com | - | Auto | - |
|
||||
| CNAME | autodiscover | mail.example.com | - | Auto | DNS only |
|
||||
|
||||
PTR Record (at hosting provider):
|
||||
- 203.0.113.50 → mail.example.com
|
||||
|
||||
---
|
||||
|
||||
## Support Resources
|
||||
|
||||
- **Cloudflare DNS Documentation**: https://developers.cloudflare.com/dns/
|
||||
- **SPF Record Checker**: https://www.kitterman.com/spf/validate.html
|
||||
- **DKIM Validator**: https://dkimvalidator.com/
|
||||
- **DNS Propagation Checker**: https://www.whatsmydns.net/
|
||||
|
||||
Good luck with your DNS setup! 🚀
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
---
|
||||
id: Etc Mail-server
|
||||
aliases: []
|
||||
tags: []
|
||||
---
|
||||
|
||||
- [ ] ***
|
||||
id: Etc Mail-server
|
||||
aliases: []
|
||||
tags: []
|
||||
|
||||
---
|
||||
|
||||
```bash
|
||||
mysql -u mailuser -p mailserver
|
||||
```
|
||||
|
||||
```sql
|
||||
-- Add work subdomain if needed (optional)
|
||||
INSERT INTO virtual_domains (name) VALUES ('liphlink.xyz');
|
||||
|
||||
-- Get domain IDs
|
||||
SELECT id, name FROM virtual_domains;
|
||||
|
||||
-- Add aliases (replace domain_id with correct IDs)
|
||||
-- Alias: work@liphlink.xyz -> phil@liphlink.xyz
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination)
|
||||
VALUES (1, 'p.waibel@liphlink.xyz', 'phil@liphlink.xyz');
|
||||
|
||||
-- Alias: phil@work.liphlink.xyz -> phil@liphlink.xyz
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination)
|
||||
VALUES (2, 'phil@work.liphlink.xyz', 'phil@liphlink.xyz');
|
||||
|
||||
-- Verify
|
||||
SELECT * FROM virtual_aliases;
|
||||
EXIT;
|
||||
```
|
||||
|
||||
## example setup for multiple users, aliases and mailboxes
|
||||
|
||||
```sql
|
||||
-- Connect to database
|
||||
USE mailserver;
|
||||
|
||||
-- 1. Create the actual mailboxes (real users)
|
||||
INSERT INTO virtual_users (domain_id, email, password) VALUES
|
||||
(4, 'phil@liphlink.xyz', '{SHA512-CRYPT}$6$jBiwDe/FJozZFzKV$D0GFlDuY4xLt.T9OavIBkEZ.7.q6KnRhWzHXCxwDQmaI4p3wkHwZEjc1e4.KllL1xeYzKARdDrqWl0ScHli05/'), -- Person 1's mailbox
|
||||
(4, 'spam@liphlink.xyz', '{SHA512-CRYPT}$6$S8UOlG0ImhGWLwy5$evkDoMMh8NYGrQljiEV7iM6.0vBkMpq4Q/7ybpGW182w7aRtaFFWMnP9VYD1.PMuJosVEBDbE0SsC0xwR44851'), -- Person 1's spam mailbox
|
||||
(4, 'home@liphlink.xyz', '{SHA512-CRYPT}$6$wD6/BL3lrikvipl4$TE6STLy6oOs3t2fAwAjfEPwB1gLhYrJbC08ZLUlz/qbikscnA3ssexDEzUjLIBHYP/SAYIg5B2RpMhYEdG0Ru/'), -- Person 1 & 2's shared mailbox
|
||||
(4, 'miri@liphlink.xyz', '{SHA512-CRYPT}$6$ofVB6CU..zVerp/c$TTFn6YAt1zBHK4FMyUb2FWMqQMQAVuXPxOZzds6HlfHLCh1jbbDmDsE0MU7iNvSsoopV2OwNQTCCLXIQOUUld.'), -- Person 2's mailbox
|
||||
(4, 'coaching@liphlink.xyz', '{SHA512-CRYPT}$6$wp.Bxin7aZjsJDwZ$OKzgR2Vu8puw7xUKvjHzqZgCgj0rfbjBzbdZcu8hxtRo0q9aHxUaL9.tYMGHGOMzELCteIMOo8oicg4EbpZ2E1'); -- Person 2's work mailbox
|
||||
|
||||
-- 2. Person 1's aliases (both forward to person1@liphlink.xyz)
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES
|
||||
(4, 'p.waibel@liphlink.xyz', 'phil@liphlink.xyz'),
|
||||
(4, 'philipp.waibel@liphlink.xyz', 'phil@liphlink.xyz'),
|
||||
(4, 'pw@liphlink.xyz', 'phil@liphlink.xyz');
|
||||
|
||||
-- 2. Person 1's spam adress (both forward to person1@liphlink.xyz)
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES
|
||||
(4, 'blue@liphlink.xyz', 'spam@liphlink.xyz'),
|
||||
(4, 'red@liphlink.xyz', 'spam@liphlink.xyz');
|
||||
|
||||
-- 4. Person 2's aliases (all three forward to person2@liphlink.xyz)
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES
|
||||
(4, 'mh@liphlink.xyz', 'miri@liphlink.xyz'),
|
||||
(4, 'miriam.herten@liphlink.xyz', 'miri@liphlink.xyz'),
|
||||
(4, 'miriam@liphlink.xyz', 'miri@liphlink.xyz');
|
||||
|
||||
-- 2. Person 1's spam adress (both forward to person1@liphlink.xyz)
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES
|
||||
(4, 'zelgi@liphlink.xyz', 'home@liphlink.xyz');
|
||||
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES
|
||||
(4, 'embodiment@liphlink.xyz', 'coaching@liphlink.xyz'),
|
||||
(4, 'contact@liphlink.xyz', 'coaching@liphlink.xyz');
|
||||
|
||||
-- Forward to multiple recipients
|
||||
INSERT INTO virtual_aliases (domain_id, source, destination)
|
||||
VALUES (1, 'team@liphlink.xyz', 'phil@liphlink.xyz,alice@liphlink.xyz');
|
||||
|
||||
-- View everything
|
||||
SELECT
|
||||
'USERS' as type,
|
||||
id,
|
||||
email as address,
|
||||
'MAILBOX' as note
|
||||
FROM virtual_users
|
||||
WHERE domain_id = 1
|
||||
UNION ALL
|
||||
SELECT
|
||||
'ALIASES' as type,
|
||||
id,
|
||||
CONCAT(source, ' → ', destination) as address,
|
||||
'FORWARDS TO' as note
|
||||
FROM virtual_aliases
|
||||
WHERE domain_id = 1
|
||||
ORDER BY type, address;
|
||||
```
|
||||
|
||||
## Create Tables
|
||||
|
||||
```sql
|
||||
-- Domains table
|
||||
CREATE TABLE IF NOT EXISTS virtual_domains (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- Users table
|
||||
CREATE TABLE IF NOT EXISTS virtual_users (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
domain_id INT NOT NULL,
|
||||
password VARCHAR(200) NOT NULL,
|
||||
email VARCHAR(120) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY email (email),
|
||||
FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- Aliases table
|
||||
CREATE TABLE IF NOT EXISTS virtual_aliases (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
domain_id INT NOT NULL,
|
||||
source VARCHAR(100) NOT NULL,
|
||||
destination VARCHAR(100) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
```
|
||||
|
||||
## Show table contents
|
||||
|
||||
```sql
|
||||
-- Show all domains
|
||||
SELECT * FROM virtual_domains;
|
||||
|
||||
-- Show all users
|
||||
SELECT * From virtual_users;
|
||||
|
||||
-- Show all aliases
|
||||
SELECT * From virtual_aliases;
|
||||
```
|
||||
|
||||
## Passwords for mailboxes
|
||||
|
||||
```
|
||||
phil@liphlink.xyz: Fqi5UAyr46e69fG
|
||||
spam@liphlink.xyz: ANZ6JJPBiB7k1c7k
|
||||
miri@liphlink.xyz: HORsyzL7jV7jQzP
|
||||
home@liphlink.xyz: zjlWmau4u7b19MS
|
||||
coaching@liphlink.xyz: roUHvaetocCWFmgY
|
||||
```
|
||||
|
||||
# Create password files
|
||||
mkdir -p ~/.mail-passwords
|
||||
echo "Fqi5UAyr46e69fG" > ~/.mail-passwords/phil
|
||||
echo "ANZ6JJPBiB7k1c7k" > ~/.mail-passwords/spam
|
||||
chmod 600 ~/.mail-passwords/*
|
||||
|
||||
# Update .mbsyncrc
|
||||
sed -i 's|PassCmd "pass show mail/phil@liphlink.xyz"|PassCmd "cat ~/.mail-passwords/phil"|g' ~/.mbsyncrc
|
||||
sed -i 's|PassCmd "pass show mail/spam@liphlink.xyz"|PassCmd "cat ~/.mail-passwords/spam"|g' ~/.mbsyncrc
|
||||
|
||||
# Test IMAP connection manually
|
||||
openssl s_client -connect mail.liphlink.xyz:993 -quiet
|
||||
|
||||
# Then type (use your password):
|
||||
a LOGIN phil@liphlink.xyz Fqi5UAyr46e69fG
|
||||
b SELECT INBOX
|
||||
c FETCH 1:5 (FLAGS SUBJECT)
|
||||
d LOGOUT
|
||||
+483
@@ -0,0 +1,483 @@
|
||||
Great! Let's take your aerc setup to the next level. Here are several enhancements:
|
||||
|
||||
## 1. Color Schemes & Styling
|
||||
|
||||
### Custom styleset for priority/tags
|
||||
|
||||
Create a custom styleset:
|
||||
```bash
|
||||
mkdir -p ~/.config/aerc/stylesets
|
||||
nano ~/.config/aerc/stylesets/custom
|
||||
```
|
||||
|
||||
Paste this (customize colors as you like):
|
||||
|
||||
```ini
|
||||
# Basic UI
|
||||
*.default=true
|
||||
*.normal=default
|
||||
*.selected=reverse
|
||||
border.default=true
|
||||
|
||||
# Message list - Priority coloring
|
||||
msglist_unread.fg=bold
|
||||
msglist_unread.bg=default
|
||||
|
||||
# Priority 1 - RED/URGENT
|
||||
msglist_marked.fg=red
|
||||
msglist_marked.bg=default
|
||||
msglist_marked.selected.fg=black
|
||||
msglist_marked.selected.bg=red
|
||||
|
||||
# Tag-based coloring
|
||||
msglist_flagged.fg=yellow
|
||||
msglist_flagged.bg=default
|
||||
|
||||
# Read messages - dimmed
|
||||
msglist_read.fg=242
|
||||
msglist_read.bg=default
|
||||
|
||||
# Deleted
|
||||
msglist_deleted.fg=darkgray
|
||||
msglist_deleted.bg=default
|
||||
|
||||
# Message viewer
|
||||
title.fg=cyan
|
||||
title.bg=default
|
||||
header.fg=green
|
||||
header.bg=default
|
||||
|
||||
# Composer
|
||||
tab.fg=white
|
||||
tab.bg=black
|
||||
tab.selected.fg=black
|
||||
tab.selected.bg=cyan
|
||||
|
||||
# Status bar
|
||||
statusline_default.fg=white
|
||||
statusline_default.bg=black
|
||||
statusline_error.fg=red
|
||||
statusline_error.bg=black
|
||||
statusline_success.fg=green
|
||||
statusline_success.bg=black
|
||||
|
||||
# Sidebar folders
|
||||
dirlist_default.fg=white
|
||||
dirlist_default.bg=default
|
||||
dirlist_unread.fg=cyan
|
||||
dirlist_unread.bg=default
|
||||
dirlist_recent.fg=yellow
|
||||
dirlist_recent.bg=default
|
||||
|
||||
# Completion menu
|
||||
completion_default.fg=white
|
||||
completion_default.bg=black
|
||||
completion_selected.fg=black
|
||||
completion_selected.bg=cyan
|
||||
|
||||
# Spinner
|
||||
spinner.fg=cyan
|
||||
spinner.bg=default
|
||||
```
|
||||
|
||||
**Enable it in** `~/.config/aerc/aerc.conf`:
|
||||
```ini
|
||||
[ui]
|
||||
styleset-name=custom
|
||||
```
|
||||
|
||||
### Advanced: Color by tag/priority
|
||||
|
||||
In `~/.config/aerc/aerc.conf`:
|
||||
```ini
|
||||
[ui]
|
||||
# Show icons/symbols for tags
|
||||
icon-unread=✉
|
||||
icon-replied=↩
|
||||
icon-attachment=📎
|
||||
icon-signed=🔒
|
||||
icon-encrypted=🔐
|
||||
|
||||
# Threading
|
||||
threading-enabled=true
|
||||
```
|
||||
|
||||
### Message list formatting with colors
|
||||
|
||||
Edit `~/.config/aerc/aerc.conf`:
|
||||
```ini
|
||||
[ui]
|
||||
# Custom index format with conditional colors
|
||||
index-columns = date<20,name<25,flags>4,subject<*
|
||||
column-date = {{.DateAutoFormat .Date.Local}}
|
||||
column-name = {{index (.From | names) 0}}
|
||||
column-flags = {{.Flags | join ""}}
|
||||
column-subject = {{.ThreadPrefix}}{{.Subject}}
|
||||
|
||||
# Timestap format
|
||||
timestamp-format=2006-01-02 15:04
|
||||
this-day-time-format=15:04
|
||||
this-week-time-format=Mon 15:04
|
||||
this-year-time-format=Jan 02
|
||||
```
|
||||
|
||||
## 2. Advanced Tag-Based Coloring
|
||||
|
||||
Create a script to colorize by tag:
|
||||
```bash
|
||||
nano ~/.config/aerc/scripts/colorize-tags.sh
|
||||
```
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Color messages based on notmuch tags
|
||||
|
||||
MSGID="$1"
|
||||
TAGS=$(notmuch search --output=tags id:$MSGID)
|
||||
|
||||
if echo "$TAGS" | grep -q "priority1"; then
|
||||
echo -e "\033[1;31m" # Bold red
|
||||
elif echo "$TAGS" | grep -q "priority2"; then
|
||||
echo -e "\033[1;33m" # Bold yellow
|
||||
elif echo "$TAGS" | grep -q "spam"; then
|
||||
echo -e "\033[0;90m" # Gray
|
||||
elif echo "$TAGS" | grep -q "newsletter"; then
|
||||
echo -e "\033[0;36m" # Cyan
|
||||
else
|
||||
echo -e "\033[0m" # Default
|
||||
fi
|
||||
```
|
||||
|
||||
Make executable:
|
||||
```bash
|
||||
chmod +x ~/.config/aerc/scripts/colorize-tags.sh
|
||||
```
|
||||
|
||||
## 3. Better Message Viewing
|
||||
|
||||
### Syntax highlighting for code in emails
|
||||
|
||||
Install:
|
||||
```bash
|
||||
sudo pacman -S highlight bat
|
||||
```
|
||||
|
||||
Edit `~/.config/aerc/aerc.conf`:
|
||||
```ini
|
||||
[viewer]
|
||||
pager=less -R
|
||||
|
||||
# Syntax highlight code blocks
|
||||
text/plain=bat --style=plain --paging=never --color=always
|
||||
|
||||
# Or use highlight
|
||||
# text/plain=highlight -O ansi --force
|
||||
```
|
||||
|
||||
### Better HTML rendering with custom CSS
|
||||
|
||||
Create `~/.config/aerc/html.css`:
|
||||
```css
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 20px auto;
|
||||
line-height: 1.6;
|
||||
color: #e0e0e0;
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #58a6ff;
|
||||
}
|
||||
|
||||
code {
|
||||
background: #2d2d2d;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #2d2d2d;
|
||||
padding: 10px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
```
|
||||
|
||||
Update viewer:
|
||||
```ini
|
||||
[viewer]
|
||||
html-filter=pandoc -f html -t plain | bat --style=plain --color=always
|
||||
```
|
||||
|
||||
## 4. Fuzzy Finding & Better Search
|
||||
|
||||
### Install fzf integration
|
||||
|
||||
```bash
|
||||
sudo pacman -S fzf
|
||||
```
|
||||
|
||||
Add to `~/.config/aerc/binds.conf`:
|
||||
```ini
|
||||
[messages]
|
||||
# Fuzzy find emails
|
||||
/ = :term fzf-aerc<Enter>
|
||||
```
|
||||
|
||||
Create the script `~/.local/bin/fzf-aerc`:
|
||||
```bash
|
||||
#!/bin/bash
|
||||
notmuch search --output=messages '*' | \
|
||||
fzf --preview 'notmuch show {}' | \
|
||||
xargs -I {} aerc ":open {}<Enter>"
|
||||
```
|
||||
|
||||
Make executable:
|
||||
```bash
|
||||
chmod +x ~/.local/bin/fzf-aerc
|
||||
```
|
||||
|
||||
## 5. Email Templates
|
||||
|
||||
Create templates directory:
|
||||
```bash
|
||||
mkdir -p ~/.config/aerc/templates
|
||||
```
|
||||
|
||||
### Quick reply template
|
||||
`~/.config/aerc/templates/quick-reply`:
|
||||
```
|
||||
Thanks for reaching out!
|
||||
|
||||
{{.OriginalMessage}}
|
||||
|
||||
Best regards,
|
||||
{{.From}}
|
||||
```
|
||||
|
||||
### Meeting confirmation template
|
||||
`~/.config/aerc/templates/meeting-confirm`:
|
||||
```
|
||||
Hi {{.To}},
|
||||
|
||||
Confirmed! Looking forward to our meeting on {{.Subject}}.
|
||||
|
||||
Best,
|
||||
{{.From}}
|
||||
```
|
||||
|
||||
### Use templates with keybinding
|
||||
|
||||
In `~/.config/aerc/binds.conf`:
|
||||
```ini
|
||||
[messages]
|
||||
,tr = :reply -t quick-reply<Enter>
|
||||
,tm = :reply -t meeting-confirm<Enter>
|
||||
```
|
||||
|
||||
## 6. Contact Management Integration
|
||||
|
||||
### Better abook integration
|
||||
|
||||
```bash
|
||||
sudo pacman -S abook
|
||||
```
|
||||
|
||||
Import contacts:
|
||||
```bash
|
||||
# From notmuch
|
||||
notmuch address --output=sender '*' | sort -u > /tmp/contacts.txt
|
||||
|
||||
# Import to abook (manual process, or script it)
|
||||
```
|
||||
|
||||
Add to `~/.config/aerc/aerc.conf`:
|
||||
```ini
|
||||
[compose]
|
||||
address-book-cmd=abook --mutt-query '%s'
|
||||
```
|
||||
|
||||
### Or use khard (CardDAV)
|
||||
|
||||
```bash
|
||||
yay -S khard
|
||||
```
|
||||
|
||||
Sync with ProtonMail contacts via vdirsyncer.
|
||||
|
||||
## 7. Notification System
|
||||
|
||||
### Desktop notifications for new mail
|
||||
|
||||
Install:
|
||||
```bash
|
||||
sudo pacman -S libnotify
|
||||
```
|
||||
|
||||
Update `~/.local/bin/sync-mail.sh`:
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Store count before sync
|
||||
BEFORE=$(notmuch count tag:unread)
|
||||
|
||||
# Sync
|
||||
mbsync -a
|
||||
notmuch new
|
||||
PYTHONWARNINGS="ignore::UserWarning" afew --tag --new
|
||||
|
||||
# Count after
|
||||
AFTER=$(notmuch count tag:unread)
|
||||
NEW=$((AFTER - BEFORE))
|
||||
|
||||
# Notify if new mail
|
||||
if [ $NEW -gt 0 ]; then
|
||||
# Check for priority mail
|
||||
PRIORITY=$(notmuch count tag:priority1 AND tag:unread)
|
||||
|
||||
if [ $PRIORITY -gt 0 ]; then
|
||||
notify-send -u critical "📧 Urgent Mail" "$PRIORITY high priority message(s)"
|
||||
else
|
||||
notify-send "📬 New Mail" "$NEW new message(s)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Mail sync complete at $(date)"
|
||||
```
|
||||
|
||||
### Sound notifications
|
||||
|
||||
```bash
|
||||
sudo pacman -S sox
|
||||
```
|
||||
|
||||
Add to sync script:
|
||||
```bash
|
||||
if [ $PRIORITY -gt 0 ]; then
|
||||
play -n synth 0.3 sine 800 vol 0.5
|
||||
fi
|
||||
```
|
||||
|
||||
## 8. Productivity Integrations
|
||||
|
||||
### Send emails to task manager
|
||||
|
||||
Create `~/.config/aerc/scripts/email-to-task.sh`:
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Pipe email to task manager
|
||||
|
||||
SUBJECT=$(notmuch show --format=json "$1" | jq -r '.[0][0][0].headers.Subject')
|
||||
FROM=$(notmuch show --format=json "$1" | jq -r '.[0][0][0].headers.From')
|
||||
|
||||
# Add to taskwarrior
|
||||
task add "Email: $SUBJECT from $FROM" +email
|
||||
```
|
||||
|
||||
Keybinding:
|
||||
```ini
|
||||
[messages]
|
||||
,tt = :pipe ~/.config/aerc/scripts/email-to-task.sh<Enter>
|
||||
```
|
||||
|
||||
### Calendar integration
|
||||
|
||||
```bash
|
||||
sudo pacman -S khal vdirsyncer
|
||||
```
|
||||
|
||||
Parse calendar invites automatically in viewer.
|
||||
|
||||
## 9. Advanced Filtering Scripts
|
||||
|
||||
### Auto-respond to certain senders
|
||||
|
||||
Create `~/.config/notmuch/default/hooks/post-new`:
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Auto-archive newsletters
|
||||
notmuch tag +archived -inbox -- tag:newsletter AND tag:new
|
||||
|
||||
# Auto-mark as read if from automated systems
|
||||
notmuch tag -unread -- tag:automated AND tag:new
|
||||
|
||||
# Flag urgent keywords
|
||||
notmuch tag +urgent -- subject:"URGENT" AND tag:new
|
||||
```
|
||||
|
||||
Make executable:
|
||||
```bash
|
||||
chmod +x ~/.config/notmuch/default/hooks/post-new
|
||||
```
|
||||
|
||||
## 10. Performance Optimizations
|
||||
|
||||
In `~/.config/aerc/aerc.conf`:
|
||||
```ini
|
||||
[ui]
|
||||
# Cache headers for speed
|
||||
cache-headers=true
|
||||
|
||||
# Faster threading
|
||||
threading-enabled=true
|
||||
|
||||
# Limit initial load
|
||||
dirlist-delay=200ms
|
||||
|
||||
# Async loading
|
||||
sort=reverse-date
|
||||
|
||||
[viewer]
|
||||
# Faster paging
|
||||
parse-http-links=false
|
||||
max-mime-height=0
|
||||
```
|
||||
|
||||
## 11. Vim-like Navigation Improvements
|
||||
|
||||
Enhanced `~/.config/aerc/binds.conf`:
|
||||
```ini
|
||||
[messages]
|
||||
# Vim-style marks
|
||||
m = :mark -t<Enter>
|
||||
M = :mark -T<Enter>
|
||||
' = :mark -v<Enter>
|
||||
|
||||
# Quick archive/delete
|
||||
<Space>d = :move Trash<Enter>
|
||||
<Space>a = :move Archive<Enter>
|
||||
|
||||
# Macro-like sequences
|
||||
,aa = :mark -a<Enter>:archive<Enter>
|
||||
,dd = :mark -a<Enter>:delete<Enter>
|
||||
|
||||
# Quick jumps
|
||||
gg = :select 0<Enter>
|
||||
G = :select -1<Enter>
|
||||
<C-u> = :prev 10<Enter>
|
||||
<C-d> = :next 10<Enter>
|
||||
|
||||
# Split view
|
||||
<C-w>v = :vsplit<Enter>
|
||||
<C-w>s = :split<Enter>
|
||||
<C-w>c = :close<Enter>
|
||||
```
|
||||
|
||||
## 12. Status Bar Customization
|
||||
|
||||
In `~/.config/aerc/aerc.conf`:
|
||||
```ini
|
||||
[statusline]
|
||||
status-columns = left<*,center>=,right>*
|
||||
column-left = {{.Account}}:{{.Folder}} [{{.StatusInfo}}]
|
||||
column-center = {{.StatusDisplay}}
|
||||
column-right = {{.TrayInfo}} {{.PendingKeys}}
|
||||
```
|
||||
|
||||
## Quick Install Script for All Enhancements
|
||||
|
||||
Want me to create a single script that installs and configures all of these at once? Or would you rather add them one by one as you explore?
|
||||
|
||||
Which enhancements interest you most? I can dive deeper into any of these!
|
||||
Executable
+381
@@ -0,0 +1,381 @@
|
||||
Here's a **hypothetical but realistic Arch setup** for a Surface Pro tablet with all the touch/tablet features:
|
||||
|
||||
---
|
||||
|
||||
## **Base System Setup**
|
||||
|
||||
**1. Installation with Surface kernel:**
|
||||
```bash
|
||||
# Install base Arch
|
||||
# After base install, add linux-surface repo
|
||||
|
||||
# Add the linux-surface repository key
|
||||
wget -qO - https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc | sudo pacman-key --add -
|
||||
sudo pacman-key --finger 56C464BAAC421453
|
||||
sudo pacman-key --lsign-key 56C464BAAC421453
|
||||
|
||||
# Add repo to /etc/pacman.conf
|
||||
[linux-surface]
|
||||
Server = https://pkg.surfacelinux.com/arch/
|
||||
|
||||
# Update and install Surface kernel
|
||||
sudo pacman -Syu
|
||||
sudo pacman -S linux-surface linux-surface-headers iptsd
|
||||
```
|
||||
|
||||
**2. Core tablet packages:**
|
||||
```bash
|
||||
# Surface-specific firmware and drivers
|
||||
sudo pacman -S libwacom # Wacom/stylus support
|
||||
sudo pacman -S iptsd # Surface touchscreen daemon
|
||||
sudo systemctl enable iptsd
|
||||
|
||||
# Camera support
|
||||
sudo pacman -S linux-firmware
|
||||
# Surface cameras need special firmware from linux-surface
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Desktop Environment: GNOME (Best Touch Support)**
|
||||
|
||||
**Install GNOME with Wayland:**
|
||||
```bash
|
||||
sudo pacman -S gnome gnome-extra
|
||||
sudo pacman -S gdm
|
||||
sudo systemctl enable gdm
|
||||
|
||||
# Touch-specific tools
|
||||
sudo pacman -S gnome-shell-extension-appindicator
|
||||
sudo pacman -S gnome-browser-connector
|
||||
```
|
||||
|
||||
**GNOME gives you out-of-box:**
|
||||
- Automatic screen rotation
|
||||
- Touch gestures (swipe between workspaces)
|
||||
- On-screen keyboard (built-in)
|
||||
- Pinch-to-zoom
|
||||
- Good HiDPI scaling
|
||||
|
||||
---
|
||||
|
||||
## **Screen Rotation**
|
||||
|
||||
**Auto-rotation with iio-sensor-proxy:**
|
||||
```bash
|
||||
sudo pacman -S iio-sensor-proxy
|
||||
sudo systemctl enable iio-sensor-proxy
|
||||
|
||||
# Test rotation sensor
|
||||
monitor-sensor
|
||||
```
|
||||
|
||||
**Manual rotation keybinds (if needed):**
|
||||
```bash
|
||||
# Create a script ~/bin/rotate.sh
|
||||
#!/bin/bash
|
||||
case $(xrandr --query --verbose | grep 'connected primary' | cut -d' ' -f5) in
|
||||
normal)
|
||||
xrandr --output eDP-1 --rotate right
|
||||
;;
|
||||
right)
|
||||
xrandr --output eDP-1 --rotate inverted
|
||||
;;
|
||||
inverted)
|
||||
xrandr --output eDP-1 --rotate left
|
||||
;;
|
||||
left)
|
||||
xrandr --output eDP-1 --rotate normal
|
||||
;;
|
||||
esac
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Battery Optimization**
|
||||
|
||||
**TLP (automatic power management):**
|
||||
```bash
|
||||
sudo pacman -S tlp tlp-rdw
|
||||
sudo systemctl enable tlp
|
||||
sudo systemctl start tlp
|
||||
|
||||
# Configure /etc/tlp.conf for aggressive power saving
|
||||
sudo nano /etc/tlp.conf
|
||||
|
||||
# Key settings:
|
||||
TLP_DEFAULT_MODE=BAT
|
||||
CPU_SCALING_GOVERNOR_ON_BAT=powersave
|
||||
RUNTIME_PM_ON_BAT=auto
|
||||
```
|
||||
|
||||
**Additional power tools:**
|
||||
```bash
|
||||
sudo pacman -S powertop # Power usage analysis
|
||||
sudo pacman -S thermald # Thermal management
|
||||
sudo systemctl enable thermald
|
||||
|
||||
# Run powertop calibration once
|
||||
sudo powertop --calibrate
|
||||
```
|
||||
|
||||
**Check battery stats:**
|
||||
```bash
|
||||
sudo pacman -S acpi
|
||||
acpi -V # Show battery info
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Touch & Stylus Support**
|
||||
|
||||
**Stylus configuration:**
|
||||
```bash
|
||||
sudo pacman -S xf86-input-wacom
|
||||
# Surface Pen should work automatically with iptsd + libwacom
|
||||
|
||||
# For pressure sensitivity in apps
|
||||
sudo pacman -S xournalpp # Note-taking with pen
|
||||
sudo pacman -S krita # Drawing with pressure
|
||||
sudo pacman -S gimp
|
||||
```
|
||||
|
||||
**On-screen keyboard alternatives:**
|
||||
```bash
|
||||
# GNOME has built-in OSK, but alternatives:
|
||||
yay -S onboard # Feature-rich OSK
|
||||
yay -S squeekboard # Mobile-focused OSK
|
||||
```
|
||||
|
||||
**Touch gestures (if not using GNOME):**
|
||||
```bash
|
||||
yay -S libinput-gestures
|
||||
yay -S gestures # GUI for libinput-gestures
|
||||
|
||||
# Configure swipes, pinches, etc.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Camera Support**
|
||||
|
||||
**Video/camera stack:**
|
||||
```bash
|
||||
sudo pacman -S v4l-utils # Video4Linux utilities
|
||||
sudo pacman -S cheese # Test webcam
|
||||
sudo pacan -S pipewire pipewire-pulse wireplumber
|
||||
|
||||
# Check cameras
|
||||
v4l2-ctl --list-devices
|
||||
|
||||
# Surface cameras need IPU3 firmware
|
||||
# Should be in linux-surface kernel already
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **WiFi & Bluetooth**
|
||||
|
||||
```bash
|
||||
sudo pacman -S networkmanager network-manager-applet
|
||||
sudo systemctl enable NetworkManager
|
||||
|
||||
sudo pacman -S bluez bluez-utils
|
||||
sudo systemctl enable bluetooth
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Audio**
|
||||
|
||||
```bash
|
||||
sudo pacman -S pipewire pipewire-alsa pipewire-pulse pipewire-jack
|
||||
sudo pacman -S wireplumber
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **HiDPI Scaling**
|
||||
|
||||
**For GNOME:**
|
||||
```bash
|
||||
# Settings > Displays > Scale (100%, 200%, etc.)
|
||||
# Or via gsettings:
|
||||
gsettings set org.gnome.desktop.interface scaling-factor 2
|
||||
```
|
||||
|
||||
**For Wayland fractional scaling:**
|
||||
```bash
|
||||
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Type Cover (Keyboard) Support**
|
||||
|
||||
Should work automatically, but ensure:
|
||||
```bash
|
||||
# Check keyboard detected
|
||||
libinput list-devices
|
||||
|
||||
# Keyboard backlight control
|
||||
yay -S surface-control
|
||||
# Or manually:
|
||||
echo 1 | sudo tee /sys/class/leds/surface::kbd_backlight/brightness
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Useful Tablet Apps**
|
||||
|
||||
```bash
|
||||
# Note-taking
|
||||
sudo pacman -S xournalpp # Best for stylus notes
|
||||
yay -S rnote # Rust-based note app
|
||||
|
||||
# PDF annotation
|
||||
sudo pacman -S okular
|
||||
yay -S xournal++
|
||||
|
||||
# Drawing
|
||||
sudo pacman -S krita inkscape
|
||||
|
||||
# E-reading
|
||||
sudo pacman -S foliate # E-book reader
|
||||
sudo pacman -S zathura # PDF reader
|
||||
|
||||
# Touch-friendly file manager
|
||||
sudo pacman -S nautilus # GNOME Files
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Performance Tweaks**
|
||||
|
||||
**Reduce swappiness:**
|
||||
```bash
|
||||
echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.d/99-swappiness.conf
|
||||
```
|
||||
|
||||
**Enable ZRAM (compressed RAM):**
|
||||
```bash
|
||||
sudo pacman -S zram-generator
|
||||
sudo nano /etc/systemd/zram-generator.conf
|
||||
|
||||
[zram0]
|
||||
zram-size = ram / 2
|
||||
compression-algorithm = zstd
|
||||
```
|
||||
|
||||
**Trim SSD weekly:**
|
||||
```bash
|
||||
sudo systemctl enable fstrim.timer
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Testing Everything**
|
||||
|
||||
**Rotation:**
|
||||
```bash
|
||||
monitor-sensor # Rotate device, watch output
|
||||
```
|
||||
|
||||
**Battery:**
|
||||
```bash
|
||||
sudo tlp-stat -b # Battery stats
|
||||
sudo powertop # Power consumption
|
||||
```
|
||||
|
||||
**Touch:**
|
||||
```bash
|
||||
libinput debug-events # Watch touch events
|
||||
```
|
||||
|
||||
**Stylus:**
|
||||
```bash
|
||||
xsetwacom list devices # List stylus
|
||||
```
|
||||
|
||||
**Camera:**
|
||||
```bash
|
||||
cheese # Open camera app
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Alternative: KDE Plasma**
|
||||
|
||||
If you prefer KDE over GNOME:
|
||||
```bash
|
||||
sudo pacman -S plasma-meta kde-applications
|
||||
sudo pacman -S plasma-wayland-session
|
||||
|
||||
# KDE has:
|
||||
# - Good touch support
|
||||
# - Better customization
|
||||
# - Onboard for OSK
|
||||
# - Screen rotation works
|
||||
# - More lightweight than GNOME
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Common Issues & Fixes**
|
||||
|
||||
**Camera not working:**
|
||||
```bash
|
||||
# Update firmware
|
||||
sudo pacman -Syu
|
||||
# Check dmesg for IPU3 errors
|
||||
dmesg | grep -i ipu3
|
||||
```
|
||||
|
||||
**Stylus not detected:**
|
||||
```bash
|
||||
sudo systemctl restart iptsd
|
||||
# Check if iptsd is running
|
||||
systemctl status iptsd
|
||||
```
|
||||
|
||||
**Battery draining fast:**
|
||||
```bash
|
||||
sudo powertop --auto-tune
|
||||
# Add to systemd service for persistence
|
||||
```
|
||||
|
||||
**Screen rotation not working:**
|
||||
```bash
|
||||
# Check sensor
|
||||
monitor-sensor
|
||||
# May need to install iio-sensor-proxy-git from AUR
|
||||
yay -S iio-sensor-proxy-git
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **Maintenance**
|
||||
|
||||
```bash
|
||||
# Update system + Surface kernel
|
||||
sudo pacman -Syu
|
||||
|
||||
# Check for Surface-specific updates
|
||||
# linux-surface team releases patches regularly
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
This setup gives you:
|
||||
✅ Automatic rotation
|
||||
✅ Battery optimization (6-8 hours typical)
|
||||
✅ Working cameras (front + rear)
|
||||
✅ Stylus with pressure sensitivity
|
||||
✅ Touch gestures
|
||||
✅ On-screen keyboard
|
||||
✅ Type Cover support
|
||||
✅ Good performance
|
||||
|
||||
The key is **linux-surface kernel + GNOME/KDE + proper power management**. It won't be *exactly* like iPad smoothness, but it's very usable as a daily driver tablet.
|
||||
|
||||
Want me to elaborate on any specific part?
|
||||
Executable
+327
@@ -0,0 +1,327 @@
|
||||
Absolutely! Here's a complete step-by-step guide to set up notmuch with aerc:
|
||||
|
||||
## Step 1: Verify notmuch database location
|
||||
|
||||
```bash
|
||||
notmuch config get database.path
|
||||
```
|
||||
|
||||
This will output something like `/home/yourusername/.local/share/mail` or `/home/yourusername/Mail`. **Remember this path** - you'll need it.
|
||||
|
||||
## Step 2: Create the notmuch queries file
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/aerc
|
||||
nano ~/.config/aerc/notmuch-queries
|
||||
```
|
||||
|
||||
Paste this content (you can customize later):
|
||||
|
||||
```
|
||||
# Priority folders
|
||||
Priority 1 - Urgent=tag:priority1 AND tag:inbox
|
||||
Priority 2 - Work=tag:priority2 AND tag:inbox
|
||||
Priority 3 - Low=tag:priority3 AND tag:inbox
|
||||
|
||||
# Categories
|
||||
Newsletters=tag:newsletter
|
||||
Social Media=tag:social
|
||||
Shopping=tag:shopping
|
||||
Finance=tag:finance
|
||||
Travel=tag:travel
|
||||
Development=tag:dev
|
||||
|
||||
# Standard folders
|
||||
Inbox=tag:inbox AND NOT tag:spam
|
||||
Unread=tag:unread AND NOT tag:spam
|
||||
Sent=tag:sent
|
||||
Spam=tag:spam
|
||||
Important=tag:important
|
||||
All Mail=*
|
||||
```
|
||||
|
||||
Save and exit (Ctrl+O, Enter, Ctrl+X).
|
||||
|
||||
## Step 3: Update aerc accounts.conf
|
||||
|
||||
**First, backup your current config:**
|
||||
```bash
|
||||
cp ~/.config/aerc/accounts.conf ~/.config/aerc/accounts.conf.backup
|
||||
```
|
||||
|
||||
**Edit the config:**
|
||||
```bash
|
||||
nano ~/.config/aerc/accounts.conf
|
||||
```
|
||||
|
||||
**Replace your IMAP accounts with this** (adjust the database path from Step 1):
|
||||
|
||||
```ini
|
||||
[Proton]
|
||||
source = notmuch:///home/yourusername/.local/share/mail
|
||||
query-map = ~/.config/aerc/notmuch-queries
|
||||
outgoing = smtp://user@127.0.0.1:1025
|
||||
outgoing-cred-cmd = pass protonmail-bridge
|
||||
from = Your Name <main@proton.me>
|
||||
```
|
||||
|
||||
**Important notes:**
|
||||
- Use `notmuch://` (with three slashes) followed by the **absolute path**
|
||||
- Replace `/home/yourusername/.local/share/mail` with your actual path from Step 1
|
||||
- Replace `user` with your actual ProtonMail Bridge username
|
||||
- Replace email addresses with your actual emails
|
||||
|
||||
**If you want multiple "from" addresses:**
|
||||
|
||||
```ini
|
||||
[Proton]
|
||||
source = notmuch:///home/yourusername/.local/share/mail
|
||||
query-map = ~/.config/aerc/notmuch-queries
|
||||
outgoing = smtp://user@127.0.0.1:1025
|
||||
outgoing-cred-cmd = pass protonmail-bridge
|
||||
from = Your Name <main@proton.me>
|
||||
aliases = work@proton.me,personal@proton.me
|
||||
```
|
||||
|
||||
Save and exit.
|
||||
|
||||
## Step 4: Tag existing emails for processing
|
||||
|
||||
```bash
|
||||
# Tag all mail as 'new' so afew will process it
|
||||
notmuch tag +new -- '*'
|
||||
|
||||
# Verify
|
||||
notmuch count tag:new
|
||||
```
|
||||
|
||||
Should show your total email count (e.g., 6050).
|
||||
|
||||
## Step 5: Run afew to apply filters
|
||||
|
||||
```bash
|
||||
PYTHONWARNINGS="ignore::UserWarning" afew --tag --new --verbose
|
||||
```
|
||||
|
||||
You should see output like:
|
||||
```
|
||||
SpamFilter
|
||||
Tagging affected 145 message(s)
|
||||
Filter.1: High priority - Boss and VIPs
|
||||
Tagging affected 23 message(s)
|
||||
Filter.10: Newsletters and subscriptions
|
||||
Tagging affected 892 message(s)
|
||||
...
|
||||
```
|
||||
|
||||
## Step 6: Verify tags were applied
|
||||
|
||||
```bash
|
||||
notmuch count tag:spam
|
||||
notmuch count tag:newsletter
|
||||
notmuch count tag:priority1
|
||||
notmuch count tag:inbox
|
||||
```
|
||||
|
||||
You should see actual numbers now!
|
||||
|
||||
## Step 7: Test aerc with notmuch
|
||||
|
||||
```bash
|
||||
aerc
|
||||
```
|
||||
|
||||
**What you should see:**
|
||||
- Instead of "INBOX", "Sent", etc., you'll see your query-based folders
|
||||
- "Priority 1 - Urgent"
|
||||
- "Priority 2 - Work"
|
||||
- "Newsletters"
|
||||
- "Inbox"
|
||||
- etc.
|
||||
|
||||
**Navigate folders:**
|
||||
```
|
||||
:cf Priority 1 - Urgent<Enter>
|
||||
```
|
||||
|
||||
Or use `j/k` to navigate the folder list and press Enter.
|
||||
|
||||
## Step 8: Set up keybindings for quick navigation
|
||||
|
||||
```bash
|
||||
nano ~/.config/aerc/binds.conf
|
||||
```
|
||||
|
||||
Add to the `[messages]` section:
|
||||
|
||||
```ini
|
||||
[messages]
|
||||
# Quick folder navigation
|
||||
g1 = :cf Priority 1 - Urgent<Enter>
|
||||
g2 = :cf Priority 2 - Work<Enter>
|
||||
g3 = :cf Priority 3 - Low<Enter>
|
||||
gn = :cf Newsletters<Enter>
|
||||
gs = :cf Spam<Enter>
|
||||
gi = :cf Inbox<Enter>
|
||||
gu = :cf Unread<Enter>
|
||||
ga = :cf All Mail<Enter>
|
||||
|
||||
# Tag management
|
||||
t = :prompt 'Tag: ' 'tag '
|
||||
T = :prompt 'Remove tag: ' 'untag '
|
||||
|
||||
# Quick tags
|
||||
!1 = :tag +priority1<Enter>
|
||||
!2 = :tag +priority2<Enter>
|
||||
!s = :tag +spam<Enter>
|
||||
```
|
||||
|
||||
## Step 9: Set up automatic mail syncing
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.local/bin
|
||||
nano ~/.local/bin/sync-mail.sh
|
||||
```
|
||||
|
||||
Paste:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Sync from ProtonMail Bridge
|
||||
mbsync -a
|
||||
|
||||
# Index new messages (auto-tags them as 'new')
|
||||
notmuch new
|
||||
|
||||
# Apply filters to new messages
|
||||
PYTHONWARNINGS="ignore::UserWarning" afew --tag --new
|
||||
|
||||
echo "Mail sync complete at $(date)"
|
||||
```
|
||||
|
||||
Make it executable:
|
||||
```bash
|
||||
chmod +x ~/.local/bin/sync-mail.sh
|
||||
```
|
||||
|
||||
**Test it:**
|
||||
```bash
|
||||
~/.local/bin/sync-mail.sh
|
||||
```
|
||||
|
||||
## Step 10: Automate with systemd (optional)
|
||||
|
||||
Create the service:
|
||||
```bash
|
||||
mkdir -p ~/.config/systemd/user
|
||||
nano ~/.config/systemd/user/mailsync.service
|
||||
```
|
||||
|
||||
Paste (replace `yourusername` with your actual username):
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Mailbox sync
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/home/yourusername/.local/bin/sync-mail.sh
|
||||
```
|
||||
|
||||
Create the timer:
|
||||
```bash
|
||||
nano ~/.config/systemd/user/mailsync.timer
|
||||
```
|
||||
|
||||
Paste:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Mailbox sync timer
|
||||
|
||||
[Timer]
|
||||
OnBootSec=2m
|
||||
OnUnitActiveSec=5m
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
```
|
||||
|
||||
Enable and start:
|
||||
```bash
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now mailsync.timer
|
||||
systemctl --user status mailsync.timer
|
||||
```
|
||||
|
||||
## Step 11: Verify everything works
|
||||
|
||||
**Check aerc shows virtual folders:**
|
||||
```bash
|
||||
aerc
|
||||
```
|
||||
|
||||
Press `:cf ` and hit Tab - you should see autocomplete for your virtual folders.
|
||||
|
||||
**Check folder contents:**
|
||||
```
|
||||
:cf Priority 1 - Urgent<Enter>
|
||||
```
|
||||
|
||||
You should see emails that match the filter.
|
||||
|
||||
**Check syncing works:**
|
||||
```bash
|
||||
# Manually sync
|
||||
~/.local/bin/sync-mail.sh
|
||||
|
||||
# Check timer status
|
||||
systemctl --user list-timers
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Issue: aerc shows "No folders"**
|
||||
```bash
|
||||
# Check query-map file exists
|
||||
cat ~/.config/aerc/notmuch-queries
|
||||
|
||||
# Check path in accounts.conf
|
||||
grep source ~/.config/aerc/accounts.conf
|
||||
```
|
||||
|
||||
**Issue: Folders are empty**
|
||||
```bash
|
||||
# Check tags exist
|
||||
notmuch count tag:inbox
|
||||
notmuch count tag:newsletter
|
||||
|
||||
# If 0, re-run afew
|
||||
notmuch tag +new -- '*'
|
||||
afew --tag --new --verbose
|
||||
```
|
||||
|
||||
**Issue: Can't send emails**
|
||||
```bash
|
||||
# Test SMTP manually
|
||||
echo "test" | msmtp -a proton yourmail@proton.me
|
||||
|
||||
# Check ProtonMail Bridge is running
|
||||
pgrep -a bridge
|
||||
```
|
||||
|
||||
**Issue: "Unknown account" error**
|
||||
|
||||
Your account name in `accounts.conf` is `[Proton]` but you might be referencing it wrong. Make sure keybindings and commands use the exact name.
|
||||
|
||||
## Quick test checklist
|
||||
|
||||
- [ ] `notmuch count tag:inbox` shows a number
|
||||
- [ ] `notmuch count tag:newsletter` shows a number
|
||||
- [ ] `cat ~/.config/aerc/notmuch-queries` shows your queries
|
||||
- [ ] `aerc` shows virtual folders in the sidebar
|
||||
- [ ] `:cf Inbox<Enter>` in aerc shows emails
|
||||
- [ ] `~/.local/bin/sync-mail.sh` runs without errors
|
||||
|
||||
Once all these work, you're fully set up! Let me know which step gives you trouble.
|
||||
Reference in New Issue
Block a user