Postfix Relay - Configuration without Auth

I need to setup postfix to relay using an SMTP server. There is no AUTH LOGIN so I do not need to setup the usual sasl_passwd file.

Telnet Successful
I can successfully use telnet to send an email from the SMTP server.
[1] telnet relayserverdomainFQDN 25
[2] EHLO
[3] MAIL FROM:[email protected]
[4] RCPT TO:[email protected]
[5] DATA – add body content

Postfix Setup Not Successfull
[1] Add this value to /etc/postfix/main.cf
relayhost = [relayserverdomainFQDN]:25
[2] postfix reload
[3] sudo -u asterisk mail -s TestEmail [email protected]
Result: No relay. Email sent directly from server.

You may need to set the mynetworks variable in main.cf. So assuming your internal network is 192.168.1.0/24:

mynetworks = 127.0.0.0/8 192.168.1.0/24

No dice on the modified values:

relayhost = [relayaddress]:25
mynetworks = 127.0.0.0/8 10.0.0.0/8

May also need to specify:

smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

Make sure to restart postfix after the changes as well.

Went ahead and added that line as well as a postfix reload and service postfix restart. No luck.

Try adding check_recipient_access hash:/etc/postfix/access.recipients in the smtpd_recipient_restrictions variable. So:

smtpd_recipient_restrictions = 
   permit_sasl_authenticated,
   permit_mynetworks,
   reject_unauth_destination,
   check_recipient_access hash:/etc/postfix/access.recipients

then create /etc/postfix/access.recipients and in it put all recipient domains you want to allow

domain.com OK

Then run postmap /etc/postfix/access.recipients and restart postfix. If it’s not that then it’s past my postfix knowledge, sorry :frowning:

1 Like

While it didn’t, I do appreciate all of your help! It was a valiant effort. If I can figure this out, I’ll share the solution.

1 Like

Solution

[1] Turns out the relay was actually working (I didn’t have access to the SMTP server itself), but it kept the source from address.

[2] Edit generic file
Add: sourcefrom desiredfrom
i.e., freepbx.local [email protected]

[3] Add to main.cf
smtp_generic_maps = hash:/etc/postfix/generic

[4] Run postmap against generic

[5] reload postmap; restart postmap; run test email

1 Like

Lol I literally offered this solution to someone recently here. Good work figuring it out!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.