Home Assistant Add-on: Postfix Mail Forwarder

Home Assistant Add-on: Postfix Mail Forwarder

A simple email forwarding service.

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture

About

Sets up a postfix server to host a simple email forwarding service. This is typically used to setup and forward email from a domain you own to your primary email address.

Make sure you have generated a certificate before you start this add-on. The LetsEncrypt add-on can generate a Let’s Encrypt certificate that can be used by this add-on. Please ensure that your mail domain is covered by the certificate.

You will also need to setup an MX record for your domain and forward ports 25 and 587 in your router. If you are seeing Connect Time Out in the logs, your ISP has likely blocked outbound port 25 on their end. You will need to contact them to remove the block.

Installation

Follow these steps to get the add-on installed on your system:

  1. Navigate in your Home Assistant frontend to Supervisor -> Add-on Store.

  2. Click -> Repositories

  3. Add https://github.com/hunterjm/hassio-addons

  4. Find the “Postfix Mail Forwarder” add-on and click it.

  5. Click on the “INSTALL” button.

How to use

The Postfix Mail Forwarder add-on is commonly used in conjunction with the LetsEncrypt add-on to set up email forwarding for a custom domain. The following instructions covers this scenario.

  1. Create an MX record in your DNS provider for your mail server to use. i.e. mail.mydomain.com. This domain should also resolve to your IP via an A record or CNAME.

  2. The certificate to your MX domain should already be created via the LetsEncrypt add-on or another method. Make sure that the certificate files exist in the /ssl directory.

  3. Change the domain option to the domain name in your MX record.

  4. Configure your forwarding preferences.

  5. Save configuration.

  6. Start the add-on.

  7. Have some patience and wait a minute.

  8. Check the add-on log output to see the result.

Configuration

Add-on configuration:

forward:
- from: [email protected]
  password: test
  to:
    - [email protected]
domain: mail.testo.com
certfile: fullchain.pem
keyfile: privkey.pem

Option forward.from (required)

The email address on your domain that you wish to forward to your other email address(es).

Option forward.password (required)

The password to use for SASL authentication. A common use case is setting this up as an alias in Gmail to be able to send messages from this domain.

Option forward.to (required)

The email address(es) that this addon should forward mail to.

Option: domain (required)

The domain name to use for the mail service.

Option: certfile (required)

The certificate file to use in the /ssl directory. Keep filename as-is if you used default settings to create the certificate with the LetsEncrypt add-on.

Option: keyfile (required)

Private key file to use in the /ssl directory.

Known issues and limitations

  • Many residential ISPs block outbound traffic on port 25 by default. In that case, you will likely see a Connect Time Out message in the logs. You may be able to contact your ISP to remove this block.

  • Some email service providers require a PTR record for reverse DNS lookup. Your residential ISP may not provide one for dynamically assigned IP addresses. These emails will bounce.

  • Gmail may not deliver messages to the user’s inbox unless the forward.from domain is also configured as an alias. This article will walk you through setting that up.

Support

In case you’ve found a bug, please open an issue on our GitHub.

Hi hunterjm,

I would like to build an email archive for my emails. Would this be possible with your Addon?

If not: Do you know how I could do that?

I would like to automatically move all E-Mail that are e.g. older than 1 year to my archive, to save space on my email account. But the archive should also be reachable via Internet so I can search my old emails from my mobile phone.

I have my own domain and I’m already using cloudflare with traefik to reach Home Assistant from the Internet. But I have no experience with mail servers.

And an other question is: what is your use case for this addon?

Anyone know if it’s possible to use this add-on as a silent email relay from other mail clients on my LAN through which I can relay email securely to Gmail? That’s the use case I have.
Also, is it possible to edit the postfix config files directly? Guessing it must be?

Ah, looks like it might be broken:
“Error initializing message pipeline” postfix home assistant
@hunterjm ?

No rush, I think I’ll just spin up a Pi Zero W on my network to do what I need to do :slight_smile:

looking for some assistance.

I need to configure a smtp relay, thinking this is whats done by postfix forwarder…
I use to have google enabled with less secure apps, I have some apps on my internal network that can’t be changed and they can’t do the min requirements of google anymore.
My domain is registered with Cloudflare, and I have a Cloudflare certificate (used by a https expose link)

I’d like to basically put a smtp relay on HA, to which I will send email to then be forwarded by the postfix forwarded outbound.
G

… did you ever get this working. I have a RPi lying around, so can possible configure whats needed on it… as a option.

how/where did you do your certificate, I’d prefer not to use Letsencrypt, had major problems with them while back, switched over to CloudFlare domain and cert.

G

I just installed postfix on a separate unix box on the network. Works well.

did you need certs?

As said I got a Rpi on network doing little, so can add postfix onto that.

G

Didn’t need certs, just used an application specific password I THINK on the postfix server. Can’t remember as a while ago but it was easy and lots of tutorials to quickly walk you through it online

1 Like

thanks, got some tutorials ready/open in tabs, just havent had a gap to execute yet.

G

Did you complete your use case with this add on to function as an unsecured local SMTP relay to gmail?

Could you please share how you implemented this use case?

nope,

original plan was to host a local email server and send from apps to that and then relay from there out. I ended enabling google apps and use their new secure key to send emails.

G