Configuring postfix to relay via google or somewhere else

Looking for someone that can assist in getting postfix working on my local network, to receive email from various less than secure apps and then forward the email to the destination address.

postfix is being deployed on a RPi.

I have for now 3 apps,

  1. Paradox IP150 - I can specify a originating (from) email and password (and tick box to enable secure mode)… so can handle/define this inside, although my postfix deployment at the moment I think can’t handle this originating email address and password.
  2. Node Red, guess when #1 works I will be able to figure this one out
  3. Python app, same, once #1 and #2 is sorted sure I will be able to fix this one.

at the moment when I try and send using relay_host []:587 then I get authentication failure in mail.log, guessing as the postfix is trying to relay it actually logs into the gmail server and it’s failing, although I did specify email address and password into a sasl_password file and did the postman step, yes I did change ownership and chmod 600.

anyone that can help.

Try this relay. Much easier

Runs on Linux or Windows

Gmail checks that the envelope sender matches the owner of the mailbox, so relaying through gmail is pretty much a no-no unless everything is addressed FROM the correct address.

Unfortunately that’s about as much as I can help with. I gave up on postfix about 15 years ago and went back to what I grew up with: Exim. This forum has an Exim mail backend. Way way more powerful when you have to rewrite addresses and stuff.

1 Like


In the end I jsut want to get my emails out… and to their boxes. I got allot of people saying look at using postfix.

so I normally send all of this using as the from address, going to 3 other gmail mail boxes.
I have a CloudFlare domain… so can create a MX record and the like/never done before… and maybe send as (aka create a mailbox called services on the postfix server…

in the end I’d like to get this sending working. aka get postfix configured as a mail server that i can use to send emails out via. if that means i need to make my apps authenticate with it, insecure then I don’t mind.

reading… looks interesting… nice and simple.

any chance you can say how to configure a gate to
from what i can see:

To listen on port 25
#1 emailrelay --as-server --port 25 --spool-dir /tmp
sending via gmail port 587
#2 emailrelay --client-tls --client-auth=/etc/emailrelay.auth --spool-dir /tmp


You need to go to and enable POP or IMAP (I think POP will be the easy option.
Then run the wizard and use those settings to set it up. Wizard will create the secrets file for you, and you can edit it later with notepad/nano to what the google mail settings are in the link I sent.

You can also rerun the wizard again.

1 Like

Maybe the wizard is just for Windows. emailrelay-gui seems to be in the Windows install section. You can just run it and copy those settings to you linux config if you need to.

don’t understand why i need to enable pop or imap, that would be working anyhow ?

I’m not wanting to connect to gmail to collect email from there, I’m sending email to gmail.
guess issue might be the originating address. if that is gmail then it needs authentication, otherwise might be simplest to simply set up a mail server as say and send from that box to my mailbox.

my mail server does not need to have imap or pop access as all it’s going to do is relay for me.


Ah yes. Blond moment. Just get the SMTP settings for you Google account.

1 Like

not to use to C++ and make commands,

how do I build

tried make install


In the downloads there are .deb and .rpm builds that you can use.
.deb would be for Debian based like Ubuntu and rpm for Redhat, CentOS, etc.

else it should be something like

sudo make install
1 Like

are you running this ?

whats your usage ?


I am using this on a Windows server to relay sending mail from an old ASP.Net app that does not support all the latest security.
The SMTP server is SendGrid

1 Like

same use case me, I’m just sending via SMTP

looked at send grid but it demands a registration email other than hotmail, gmail or yahoo… only other one i have is work and thats a no go.

going to give this a go, otherwise might look at jsut setting up a full mail server on the RPi using my domain as the originating domain, might not be a bad lab to try and complete…


argggg, getting more

sudo emailrelay --client-tls --client-auth=/etc/emailrelay.auth --log-file=/home/pi/emailrelay.log

I’ve tried base64 encoding the username tinmanalarm and the password and tried both plaintext

emailrelay: info: failing file: "emailrelay.11630.1655219904.2.envelope.busy" -> "emailrelay.11630.1655219904.2.envelope.bad"
emailrelay: error: forwarding: smtp error: authentication failed using mechanism [login] and plaintext secret for [tinmanalarm] from line 1: [5.7.8 Username and Password not accepted. Learn more at\n5.7.8 m3-20020a7bcf23000000b0039c7dbafa7asm16587876wmg.19 - gsmtp]

wondering if this is the same auth error that i got from postfix.

I have used a gmail to register an account with sendgrid? I have just tried to register with a gmail account, and it works?

This is really the easiest solution - depending on how many mails you want to send. It’s free for 100 emails per day.

tried through 3 browsers, same result.


ok, eventually got sendgrid account created.

now what. whats their smtp server address that i can use, will first check confirm working in NodeRed then move onto the IP150 app.


ahhh ffs… it’s expecting y app 2fa… how the fk do i make a 10yr old app that just wants a smtp address, a username/password and port 25 specified do that.



removed 2fa…

lets see if this works.