# External SMTP relay server for the domain

**URL:** https://forum.yunohost.org/t/external-smtp-relay-server-for-the-domain/5731
**Category:** Advanced use case
**Tags:** english
**Created:** [September 14, 2018, 5:36am UTC](https://forum.yunohost.org/t/external-smtp-relay-server-for-the-domain/5731 "2018-09-14T05:36:34Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![kanhu](https://forum.yunohost.org/user_avatar/forum.yunohost.org/kanhu/32/3518_2.png) [@kanhu](https://forum.yunohost.org/u/kanhu)
#### Post date: [September 14, 2018, 7:03am UTC](https://forum.yunohost.org/t/external-smtp-relay-server-for-the-domain/5731/2 "2018-09-14T07:03:54Z")

</div>

1. Edit `/etc/postfix/main.cf`

2. Add these lines:  
smtp\_sasl\_auth\_enable = yes  
smtp\_sasl\_security\_options = noanonymous  
smtp\_sasl\_password\_maps = hash:/etc/postfix/saslpasswd  
smtp\_always\_send\_ehlo = yes  
relayhost = smtp.domain.tld

Change the `smtp.domain.tld` with your providers SMTP and add port if the port SMTP is different. Eg. `relayhost = smtp.your_domain.tld:port`

1. Create a file saslpasswd in /etc/postix. Eg. /etc/postfix/saslpasswd

2. Add your username and password in saslpasswd in following format.

3. Hash saslpasswd with following command.

4. Restart postfix.

That’s it

Test it and see the postfix logs for the relay traces.

**Note:** When the Yunohost gets updated you will have to configure **/etc/postfix/main.cf** again as Yunohost update will overwrite this file.

You can even relay from your friends Yunohost server too.

---

_[View the full topic](https://forum.yunohost.org/t/external-smtp-relay-server-for-the-domain/5731)._
