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!
|
||||
Reference in New Issue
Block a user