# Customize additional config for postfix's main.cf

**URL:** https://forum.yunohost.org/t/customize-additional-config-for-postfixs-main-cf/22958
**Category:** Advanced use case
**Tags:** postfix, english
**Created:** [January 6, 2023, 3:11pm UTC](https://forum.yunohost.org/t/customize-additional-config-for-postfixs-main-cf/22958 "2023-01-06T15:11:42Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![oberger](https://forum.yunohost.org/user_avatar/forum.yunohost.org/oberger/32/6081_2.png) [@oberger](https://forum.yunohost.org/u/oberger)
#### Post date: [January 9, 2023, 10:53am UTC](https://forum.yunohost.org/t/customize-additional-config-for-postfixs-main-cf/22958/3 "2023-01-09T10:53:18Z")

</div>

I’ve added the following hook in `/etc/yunohost/hooks.d/conf_regen/20-postfix_smtp_address_preference_ipv4`:

```auto
#!/bin/bash

# Sets IPv4 preferred on outgoing mail to avoid IPv6 blacklisting

action=$1
pending_dir=$4
postfix_conf=$pending_dir/../postfix/etc/postfix/main.cf

[["$action" == "pre"]] || exit 0
[[-e $postfix_conf]] || exit 0
echo '

# ipv4 preferred on outgoing mail to avoid IPv6 blacklisting
smtp_address_preference = ipv4
' >> $postfix_conf

```

Applying `yunohost tools regen-conf -n -d postfix` to check if that suits you, and `yunohost tools regen-conf --force postfix` whenever ready to apply

Not sure if that config is to be recommended, but at least it won’t mess with the rest of the updates of the postfix config, for me.

---

_[View the full topic](https://forum.yunohost.org/t/customize-additional-config-for-postfixs-main-cf/22958)._
