How to relay mail through another YunoHost

One of my yunohost server has been blacklisted by free for several days, Free blacklist email server if there is a big variation of email sent.

In this tuto, I explain how I have used an other yunohost server to relay my mails to Free.

Server A: is the blacklisted server
Server B: The future relay

On Server B

Create a smtp account

Add the domain to yunohost

yunohost domain add YOURDOMAIN.TLD

Create a user with a strong password

yunohost user create relay -f RELAY -l RELAY -m relay@YOURDOMAIN.TLD -p PASSWORD -q 0

Copy dkim key

Take the dkim key in Server A and copy it in Server B
Dkim keys are in /etc/dkim

On Server A

Configure SASL authentication

cd /etc/postfix
echo "SERVER_B.YOURDOMAIN.TLD relay:PASSWORD" > sasl_passwd
postmap sasl_passwd
chmod go=--- sasl_passwd
chmod go=--- sasl_passwd.db

Add a transport file

cd /etc/postfix
echo " smtp:SERVER_B.YOURDOMAIN.TLD" > transport
echo " smtp:SERVER_B.YOURDOMAIN.TLD" > transport
postmap transport
echo "transport_maps = hash:/etc/postfix/transport"  >
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Restart postfix

service postfix restart


To test you can check the log file on each server:

tail -f /var/log/mail.log

Hi @ljf ,

I have several yunohost. The first is use as a reverse proxy with the app redirect and deliver Let’s encrypt SSL certificates. The same domain is install on all. All is fine except i can’t send mail to my domain from the servers behind the reverse proxy but they can send mail to different domains like gmail or yahoo for example.
So, i can’t receive the mails system or i can’t send invitation with vaultwarden to the users of this domain.
Could i follow this tutorial to use the mail server of the reverse proxy to receive mail system? Or is there another solution?

I think you can try it and it probably could work.

Unfortunately it doesn’t work, i have this error in server A :disappointed_relieved::

status=bounced (mail for domain.tld loops back to myself)
srs_forward: <""> not rewritten: No at sign in sender address

I think the right line here would be

`echo "transport_maps = hash:/etc/postfix/transport"  >>`

With double >>