Fail2ban and swaks as email

Hello Experts,
I am trying to change the mail behavior of fail2ban to /etc/fail2ban/jail.local section mta=.
I would like to generate a fail2ban mail filter that uses swaks as mail client although the authentication, mail from, mail to are already pre-set. Unfortunately I don't find any meaningful examples in my internet search and wanted to ask politely if someone has such a configuration already running. Thank you so much

With kind regards reredok
reredokIT ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
A really elegant way to do this is to write a SWAKS wrapper script called... you guessed it... sendmail...

Then in your sendmail wrapper accept all options (as sendmail has many) + only process the few required for determining your from/to/subject... Then roll those up into a SWAKS command.

Also in your wrapper, setup your relay host name + port + user + pass.

Tip: SWAKS has no queuing system, so likely best if your wrapper first writes the email message into a directory, so if SWAKS can't connect + deliver the email immediately, you can attempt a resend at some point in the future.

If you don't care about losing a few system message, then skip the spooling/queuing of messages.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
reredokIT ConsultantAuthor Commented:
Thanks for the interesting approach. Unfortunately I don't have time to dedicate to my favorite private topic linux. But I assume it will work.  I'll get back to you if it doesn't work.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.