Score:0

Redirect local host mail to mailcow mail server ubuntu

th flag

I've installed mailcow dockerized on ubuntu 22.04 host. There is some instruction how to setup local mtu with postfix (sendmail is ubuntu default) https://docs.mailcow.email/post_installation/firststeps-local_mta/. Following this instruction I installed postfix and setup it, so now the command:

echo test | mail -s "test message" root

sends a test message, that can be read by root user using command mail.

Now I would like to make mail send emails not to local mailboxes but to the installed mailcow mailbox (in docker on the same host).

Normally I would have changed /etc/aliases and put there something like: root:myemail@mydomain and then newaliases

With current settings connection will be rejected. I've tried to play with hostname and destionation in main.cf but had no such user.

How should I setup the system now to receive local host mail in mailcow?

Score:1
si flag

You may want to use ssmtp for that. It could be installed with

apt install ssmtp

Then you need to update the config file /etc/ssmtp/ssmtp.conf:

# root is the receiving alias
[email protected]

# This is required for ssmtp to send emails with authenticated smtp
mailhub=mail.yourmailcow.com:587
[email protected]
AuthPass=your-mailcow-account-password
UseTLS=YES
UseSTARTTLS=YES

This should enable you to send emails from [email protected] over your mailcow instance via authenticated SMTP. This would make sure, that the emails are sent correctly and are not catched by the SPAM filter.

Here is an article that gives some additional information on how to use ssmtp for local mail relay.

Роман Коптев avatar
th flag
Seems like it works. While I had to add hostname (that it determines) like a domain in mailcow. Than a catch-all alias for this domain with owner my recipient account. (Except creating a system acc to send emails). Without that it sent only to root. It sends service emails form root to smbd@host and not root. If I send from local user it sends from user@host to user@host. So I needed the catch-all alias for that. While it says smth about userids < 1000 in config comments
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.