Obambu: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Obambu (https://obambu.com) is our new email server for domain '''immie.org'''. == Tips == === Send emails to test mail filters === This use <code>sendmail</code> from postfix: <source lang="bash"> #!/bin/bash # Send the email # We test both bare address and address with name ("ABC" <abc@xyz.com>). send_mail() { recipient=$1 filter=$2 echo recipient: $recipient / filter: $filter /usr/sbin/sendmail -t <<EOF From: michael.peeters@noekeon.org To: $reci...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Obambu (https://obambu.com) is our new email server for domain '''immie.org'''. |
Obambu (https://obambu.com) is our new email server for domain '''immie.org'''. |
||
== Configuration == |
|||
=== Dynamic aliases === |
|||
* Dynamic aliases are setup as global email filters. |
|||
* Example: |
|||
:* Filter name: <code>Starts with mpe.</code> |
|||
:* Rules: '''Any recipient''', '''matches regex'''. |
|||
:: <code>^mip\..*@immie\.org$</code> |
|||
:* Action: '''Deliver to folder''' |
|||
:: <code>/immie.org/mpe</code> |
|||
:* We can use a more complex regular expression to match all possible dynamic alias (doing so also kinda simplify debugging using Obambu test filter). |
|||
* It's important to use '''Any Recipient''' instead of '''To''', so that the match is done on the email address, and not the complete <code>To:</code> header that might include some extra characters (like "ABC" <abc@xyz.com>). |
|||
:* '''To''' only matches the address in <code>To:</code> (including the extra characters like name, < and >...). |
|||
* {{red|Issue}} — BCC mails are not redirected by the filter above. |
|||
:* To debug, we can use Obambu test filter utility, feeding into it the complete mail we received on postmaster account. |
|||
:: Doing so, we see that some headers are ignored by the filter (including <code>Envelope-to:</code>). |
|||
:* Our only solution so far is to do a filter '''Any header''', '''matches regex''', and a complex regex: |
|||
:: <code>\n\tfor (mip\.|m\.|mpe\.|michael|peeters-ml1|hyper|fuujuhi).*@immie\.org;\n</code> |
|||
:* This matches a line in the following header: |
|||
<source lang="text"> |
|||
Received: from ober.noekeon.org ([91.134.133.203]:56096) |
|||
by cp5.obambu.com with esmtp (Exim 4.97.1) |
|||
(envelope-from <michael.peeters@noekeon.org>) |
|||
id 1svChR-00000001Dio-3hEG |
|||
for mip.anything@immie.org; |
|||
Mon, 30 Sep 2024 11:28:13 +0200 |
|||
</source> |
|||
:* However, this '''DOES NOT WORK''' if there are multiple Bcc recipient in the same domain. In that case the <code>Received:</code> header doesn't contain any address, and only <code>Envelope-to:</code> contains the list of multiple recipients: |
|||
<source lang="text"> |
|||
Envelope-to: mip.anything@immie.org, |
|||
mpe.anything@immie.org |
|||
Received: from ober.noekeon.org ([91.134.133.203]:37740) |
|||
by cp5.obambu.com with esmtp (Exim 4.97.1) |
|||
(envelope-from <michael.peeters@noekeon.org>) |
|||
id 1svEn5-00000002MtP-0eUN; |
|||
Mon, 30 Sep 2024 13:42:10 +0200 |
|||
</source> |
|||
:* Ideally, the '''Any Recipient''' should also match the header <code>Envelope-to:</code>. |
|||
== Email migration == |
|||
We use <code>offlineimap</code> to transfer mail from Gandi.net in a local Maildir, and then to Obambu server. |
|||
* offlineimap configuration (file {{file|~/.offlineimaprc}}): |
|||
<source lang="bash"> |
|||
[general] |
|||
accounts = MpeGandi |
|||
#### MPE ################# |
|||
[Account MpeGandi] |
|||
localrepository = LocalMpe |
|||
remoterepository = RemoteMpeGandi |
|||
[Account MpeObambu] |
|||
localrepository = LocalMpe |
|||
remoterepository = RemoteMpeObambu |
|||
[Repository LocalMpe] |
|||
type = Maildir |
|||
localfolders = ~/imap.noidx/mpe |
|||
[Repository RemoteMpeGandi] |
|||
type = IMAP |
|||
remotehost = mail.gandi.net |
|||
starttls = yes |
|||
ssl = no |
|||
sslcacertfile = /etc/ssl/certs/ca-certificates.crt |
|||
remoteport = 143 |
|||
remoteuser = user@domain.org |
|||
remotepass = XXXXXXXXXXX |
|||
readonly = True |
|||
[Repository RemoteMpeObambu] |
|||
type = IMAP |
|||
remotehost = cp5.obambu.com |
|||
starttls = yes |
|||
ssl = yes |
|||
sslcacertfile = /etc/ssl/certs/ca-certificates.crt |
|||
remoteport = 993 |
|||
remoteuser = user@domain.org |
|||
remotepass = XXXXXXXXXXXXXX |
|||
readonly = False |
|||
</source> |
|||
Before sending mails to obambu: |
|||
* Remove the '''Trash''' folder. |
|||
* Add <code>INBOX.</code> to all folders without such prefix. |
|||
: This is mandatory because Obambu uses a different '''folder structure'''. |
|||
== Tips == |
== Tips == |
Latest revision as of 11:48, 30 September 2024
Obambu (https://obambu.com) is our new email server for domain immie.org.
Configuration
Dynamic aliases
- Dynamic aliases are setup as global email filters.
- Example:
- Filter name:
Starts with mpe.
- Rules: Any recipient, matches regex.
^mip\..*@immie\.org$
- Action: Deliver to folder
/immie.org/mpe
- We can use a more complex regular expression to match all possible dynamic alias (doing so also kinda simplify debugging using Obambu test filter).
- Filter name:
- It's important to use Any Recipient instead of To, so that the match is done on the email address, and not the complete
To:
header that might include some extra characters (like "ABC" <abc@xyz.com>).
- To only matches the address in
To:
(including the extra characters like name, < and >...).
- To only matches the address in
- Issue — BCC mails are not redirected by the filter above.
- To debug, we can use Obambu test filter utility, feeding into it the complete mail we received on postmaster account.
- Doing so, we see that some headers are ignored by the filter (including
Envelope-to:
).
- Our only solution so far is to do a filter Any header, matches regex, and a complex regex:
\n\tfor (mip\.|m\.|mpe\.|michael|peeters-ml1|hyper|fuujuhi).*@immie\.org;\n
- This matches a line in the following header:
Received: from ober.noekeon.org ([91.134.133.203]:56096)
by cp5.obambu.com with esmtp (Exim 4.97.1)
(envelope-from <michael.peeters@noekeon.org>)
id 1svChR-00000001Dio-3hEG
for mip.anything@immie.org;
Mon, 30 Sep 2024 11:28:13 +0200
- However, this DOES NOT WORK if there are multiple Bcc recipient in the same domain. In that case the
Received:
header doesn't contain any address, and onlyEnvelope-to:
contains the list of multiple recipients:
- However, this DOES NOT WORK if there are multiple Bcc recipient in the same domain. In that case the
Envelope-to: mip.anything@immie.org,
mpe.anything@immie.org
Received: from ober.noekeon.org ([91.134.133.203]:37740)
by cp5.obambu.com with esmtp (Exim 4.97.1)
(envelope-from <michael.peeters@noekeon.org>)
id 1svEn5-00000002MtP-0eUN;
Mon, 30 Sep 2024 13:42:10 +0200
- Ideally, the Any Recipient should also match the header
Envelope-to:
.
- Ideally, the Any Recipient should also match the header
Email migration
We use offlineimap
to transfer mail from Gandi.net in a local Maildir, and then to Obambu server.
- offlineimap configuration (file ~/.offlineimaprc):
[general]
accounts = MpeGandi
#### MPE #################
[Account MpeGandi]
localrepository = LocalMpe
remoterepository = RemoteMpeGandi
[Account MpeObambu]
localrepository = LocalMpe
remoterepository = RemoteMpeObambu
[Repository LocalMpe]
type = Maildir
localfolders = ~/imap.noidx/mpe
[Repository RemoteMpeGandi]
type = IMAP
remotehost = mail.gandi.net
starttls = yes
ssl = no
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteport = 143
remoteuser = user@domain.org
remotepass = XXXXXXXXXXX
readonly = True
[Repository RemoteMpeObambu]
type = IMAP
remotehost = cp5.obambu.com
starttls = yes
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteport = 993
remoteuser = user@domain.org
remotepass = XXXXXXXXXXXXXX
readonly = False
Before sending mails to obambu:
- Remove the Trash folder.
- Add
INBOX.
to all folders without such prefix.
- This is mandatory because Obambu uses a different folder structure.
Tips
Send emails to test mail filters
This use sendmail
from postfix:
#!/bin/bash
# Send the email
# We test both bare address and address with name ("ABC" <abc@xyz.com>).
send_mail()
{
recipient=$1
filter=$2
echo recipient: $recipient / filter: $filter
/usr/sbin/sendmail -t <<EOF
From: michael.peeters@noekeon.org
To: $recipient
Subject: Test email for filter: $filter
This is a test email to check that the filter
at server level works correctly.
If this mail shouldn't be sent to you, tell me ;-)
Test email for filter: $filter
EOF
/usr/sbin/sendmail -t <<EOF
From: michael.peeters@noekeon.org
To: "Some Name Here" <$recipient>
Subject: Test email for filter: $filter
This is a test email to check that the filter
at server level works correctly.
If this mail shouldn't be sent to you, tell me ;-)
Test email for filter: $filter
EOF
}
prefix="mpe."; send_mail "${prefix}anything@immie.org" "starts with $prefix"
prefix="mip."; send_mail "${prefix}anything@immie.org" "starts with $prefix"