---
title: 'Postfix sender dependent relay'
url: 'https://mo.homelinux.net/home/postfix-sender-dep'
markdown: 'https://mo.homelinux.net/home/postfix-sender-dep.md'
date: '2009-10-03'
description: 'From version 2.3 onwards Postfix supports multiple accounts for sending mail. This can be useful in private or SOHO environments, when mailaccounts from different ISPs are used on the same postfix server. In the'
taxonomy:
  category:
    - blog
  tag:
    - mail
    - postfix
  archives_month:
    - oct_2009
  archives_year:
    - '2009'
---

[ Home ](https://mo.homelinux.net/)      Postfix sender dependent relay    

## [Postfix sender dependent relay](https://mo.homelinux.net/home/postfix-sender-dep)

    3rd Oct 2009   [mail](https://mo.homelinux.net/tag:mail#body-wrapper) [postfix](https://mo.homelinux.net/tag:postfix#body-wrapper)  

From version 2.3 onwards Postfix supports multiple accounts for sending mail. This can be useful in private or SOHO environments, when mailaccounts from different ISPs are used on the same postfix server.

In the following example, Postfix will look up the SASL file by sender for authentication then it will search the per-sender relayhost file for the relayhost to send the email depending on sender address.

```
# nano /etc/postfix/main.cf:
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
relayhost = [mail.myisp.tld]

# nano /etc/postfix/sasl_passwd:
user1@example.com   username1:password1
user2@example.net   username2:password2

# nano /etc/postfix/sender_relay:
user1@example.com [mail.example.com]
user2@example.net [mail.example.net]
```

Don't forget to postmap these files after creating/editing

 [ Previous Post](https://mo.homelinux.net/home/deb-repo) [Next Post ](https://mo.homelinux.net/home/harden-ssh)

#### Random Article

 [ I'm Feeling Lucky!](https://mo.homelinux.net/random)

#### Popular Tags

#### Archives

- [ 1 June 2006  ](https://mo.homelinux.net/archives_month:jun_2006)
- [ 1 August 2007  ](https://mo.homelinux.net/archives_month:aug_2007)
- [ 1 November 2007  ](https://mo.homelinux.net/archives_month:nov_2007)
- [ 2 February 2008  ](https://mo.homelinux.net/archives_month:feb_2008)
- [ 1 March 2008  ](https://mo.homelinux.net/archives_month:mar_2008)
- [ 1 July 2008  ](https://mo.homelinux.net/archives_month:jul_2008)
- [ 2 August 2008  ](https://mo.homelinux.net/archives_month:aug_2008)
- [ 1 September 2008  ](https://mo.homelinux.net/archives_month:sep_2008)
- [ 1 November 2008  ](https://mo.homelinux.net/archives_month:nov_2008)
- [ 1 February 2009  ](https://mo.homelinux.net/archives_month:feb_2009)
- [ 1 October 2009  ](https://mo.homelinux.net/archives_month:oct_2009)
- [ 1 August 2013  ](https://mo.homelinux.net/archives_month:aug_2013)
- [ 1 November 2014  ](https://mo.homelinux.net/archives_month:nov_2014)
- [ 2 March 2015  ](https://mo.homelinux.net/archives_month:mar_2015)
- [ 1 October 2015  ](https://mo.homelinux.net/archives_month:oct_2015)
- [ 1 December 2015  ](https://mo.homelinux.net/archives_month:dec_2015)
- [ 1 January 2016  ](https://mo.homelinux.net/archives_month:jan_2016)
- [ 1 March 2017  ](https://mo.homelinux.net/archives_month:mar_2017)
- [ 1 August 2017  ](https://mo.homelinux.net/archives_month:aug_2017)
- [ 2 June 2020  ](https://mo.homelinux.net/archives_month:jun_2020)
- [ 1 November 2020  ](https://mo.homelinux.net/archives_month:nov_2020)
- [ 1 December 2020  ](https://mo.homelinux.net/archives_month:dec_2020)
- [ 1 January 2021  ](https://mo.homelinux.net/archives_month:jan_2021)
- [ 1 February 2021  ](https://mo.homelinux.net/archives_month:feb_2021)
- [ 1 March 2021  ](https://mo.homelinux.net/archives_month:mar_2021)
- [ 1 April 2021  ](https://mo.homelinux.net/archives_month:apr_2021)
- [ 1 May 2021  ](https://mo.homelinux.net/archives_month:may_2021)
- [ 1 October 2021  ](https://mo.homelinux.net/archives_month:oct_2021)
- [ 1 February 2022  ](https://mo.homelinux.net/archives_month:feb_2022)
- [ 1 March 2022  ](https://mo.homelinux.net/archives_month:mar_2022)
- [ 1 May 2023  ](https://mo.homelinux.net/archives_month:may_2023)
- [ 1 December 2024  ](https://mo.homelinux.net/archives_month:dec_2024)
- [ 1 March 2025  ](https://mo.homelinux.net/archives_month:mar_2025)
- [ 1 March 2026  ](https://mo.homelinux.net/archives_month:mar_2026)

---

## Navigation

- Parent: [Home](https://mo.homelinux.net/index.md)
- Previous: [Hardening SSH](https://mo.homelinux.net/home/harden-ssh.md)
- Next: [Local Debian repository](https://mo.homelinux.net/home/deb-repo.md)
