Closed m-schoder closed 8 months ago
After almost abandoning SMF and looking for paid solutions I found out, that Google just silently drops your email if it is forwarded to the same address as it originiated. 😠 Thanks Google 🖕
Everything works now.
Here is my docker-compose file:
version: "3.5"
services:
smf:
container_name: mail-forwarder
image: zixia/simple-mail-forwarder
restart: always
ports:
- "25:25"
environment:
- SMF_DOMAIN=${SMF_DOMAIN}
- SMF_CONFIG=${SMF_CONFIG}
- SMF_SRS=true
- SMF_POSTFIXMAIN_sender_canonical_maps=tcp:localhost:10001
- SMF_POSTFIXMAIN_sender_canonical_classes=envelope_sender
- SMF_POSTFIXMAIN_recipient_canonical_maps=tcp:localhost:10002
- SMF_POSTFIXMAIN_recipient_canonical_classes=envelope_recipient,header_recipient
volumes:
- /opt/projects/logs/mail_forwarder:/var/log/postfix
- ${MAIL_FORWARDER_DKIM}:/var/db/dkim
Here is the documentation I wrote for future me:
https://github.com/huan/docker-simple-mail-forwarder
Do NOT use the same Gmail address to test forwarding, because Gmail silently drops any email which is forwarded back to you. F.e. you won't receive any forwarded email if you send an email from my.account@gmail.com
to your domain test@my-domain.at
and have SMF configured that the email will be forwarded back to my.account@gmail.com
. Google will send an OK Response to your postfix service but will silently drop the email and it will not be delivered.
Google might mark your emails as spam and put them in your spam folder. I have not found a reliable way to combat this but you can set up a filter in your Gmail settings to circumvent this.
Microsoft 365 marks any emails as spam, which do not pass their filters and puts them into quarantine while also (like Google) sending your postfix servcie an OK response. Their filters sadly also mark emails as spam which have a subject/body like foo
, test
, 123
etc. Although you should get an info-email that one of your recent emails was put into quarantine but this can take several hours while you might be debugging a problem that does not exist. The solution is to copy-paste anything somewhat serious into the subject/body of your test emails.
Setup a MX
Record like so:
Host | Type | MX | Destination |
---|---|---|---|
@ | MX | 0 | your-domain.at |
Setup a SPF
Record like so:
Host | Type | MX | Destination |
---|---|---|---|
your-domain.at | TXT | - | v=spf1 ip4:\ |
Setup a DKIM
Record like so:
Host | Type | MX | Destination |
---|---|---|---|
default._domainkey | TXT | - | v=DKIM1;t=s;p=\ |
You can generate a key pair at easydmarc.com.
Setup a DMARC
Record like so:
Host | Type | MX | Destination |
---|---|---|---|
_dmarc | TXT | - | v=DMARC1; p=reject; rua=mailto:your.email@example.com |
Store the generated DKIM
key pair somewhere on the host machine and export the directory to the environment variable MAIL_FORWARDER_DKIM
, so the mounted volume ${MAIL_FORWARDER_DKIM}:/var/db/dkim
will be set up correctly.
Make sure that your private key is named default.private
.
Setup rDNS to point to mail.your-domain.at
(rDNS should be configured as 3rd level domain as per RFC) in your Server Settings. For servers hosted by netcup this can be done in the Server Control Panel. For servers hosted by lansol the Customer Support has to be contacted. So this is dependent on your server provider.
Hi @m-schoder ,
Thank you very much for posting your solution with the detailed problem!
I'd love to invite you to add your documentation to the SMF README so that later users will quickly solve problems like yours and read your clear setup guide.
Please feel free to create a PR for it if you would like to.
Have a great new year ahead!
Google and other Services (like www.fhooe.at) do not deliver my forwarded mails, but services like www.temp-mail.org do.
I replaced my real domain with
my-domain
and my real gmail address withmy.mail@gmail.com
My docker compose:
docker compose up
output:postfix log after container start:
postfix log when a mail is forwarded:
Furthermore, after the container runs for a while I get the following warnings:
On my domain I have an SPF, MX and DKIM Record setup as well as rDNS.
Any help would be greatly appreciated.