After about 30 hours of almost beating my head to the walls I had to come to the conclusion, it's better if I write to people who might be more well-versed in this topic.
I have a Digitalocean server using Ubuntu 22.
Yes I know Digitalocean does not support sending mails and the such, but I'm only using postfix as a simple relay server, nothing else.
Basically I'm using Amazon SES at this moment, to send a mail to ex: "someaddress@customdomain.com". I have several domains that needs to be handled not just one, and all of these domain's configuration (DNS) are correctly set pointing to the server. It was actually working before with brevo, but I must have had some misconfiguration, because they have randomly suspended the account for TOS breach, which was of course not given with any reason, other than "sorry you're suspended".
I'm suspecting I was relaying "From:" addresses directly from senders, and they thought someone took over the account or something, which is fair.
Anyway... Now that I've described the basic setup, and circumstances. The problem is, I have a filter set up, which is absolutely crucial to make this work, and it seems like if I make a custom content_filter service in master.cf:
shell_content_filter unix - n n - - pipe
flags=Rq user=filteruser argv=/usr/local/bin/minimal_filter.sh
This is the part of the log where we can see the problem:
"relay=shell_content_filter, delay=0.04, delays=0.01/0/0/0.02, dsn=2.0.0, status=sent (delivered via shell_content_filter service"
And in main.cf:
content_filter = shell_content_filter
receive_override_options = no_address_mappings
Yes there is a "filteruser" created, and yes it works correctly, all permissions are correctly set, and tested, everything is running fine, but my filter is getting recognized as a relay, and it is literally saying the emails are getting delivered by an external service which makes no sense... to me at least.
Not sure if this is enough info, I'd really appreciate if someone knows what is going on, because I'm in quite a lot of trouble, emails are lost, never to be recovered, and I still cant make it work.