I got the chance to work on what you recommended.  Thank you Wietse.

main.cf:
# transactional email for the ministry
sender_dependent_relayhost_maps = regexp:/etc/postfix/sender_relay.regexp

sender_relay.regexp:
# email sent from the ministry domain will use the raystedman: smtp
transport and relay to smtp-relay.gmail.com
/@raystedman\.org$/    raystedman:[smtp-relay.gmail.com]

master.cf:
# ministry transactional email will use this transport and ip address
raystedman unix  -       -       n       -     -       smtp
  -o smtp_bind_address=xxx.xxx.xxx.234

[rsm@mail0 mail0]$ sudo systemctl restart postfix
[rsm@mail0 mail0]$ journalctl -u postfix -f
Aug 28 22:08:13 mail0.raystedman.org postfix/smtpd[49119]: connect
from mail0-p.raystedman.org[xxx.xxx.xxx.174]
Aug 28 22:08:13 mail0.raystedman.org postfix/smtpd[49119]:
0B5D085D65D: client=mail0-p.raystedman.org[xxx.xxx.xxx.174]
Aug 28 22:08:13 mail0.raystedman.org postfix/cleanup[49123]:
0B5D085D65D: message-id=<cdbed6cbe27b92e1b49745731a388a01@swift.generated>
Aug 28 22:08:13 mail0.raystedman.org postfix/qmgr[49108]: 0B5D085D65D:
from=<webmas...@raystedman.org>, size=606, nrcpt=1 (queue active)
Aug 28 22:08:13 mail0.raystedman.org postfix/smtpd[49119]: disconnect
from mail0-p.raystedman.org[xxx.xxx.xxx.174] ehlo=1 mail=1 rcpt=1
data=1 quit=1 commands=5
Aug 28 22:08:13 mail0.raystedman.org r238/smtp[49124]: fatal: unknown
service: [smtp-relay.gmail.com]/tcp
Aug 28 22:08:14 mail0.raystedman.org postfix/qmgr[49108]: warning:
private/r238 socket: malformed response
Aug 28 22:08:14 mail0.raystedman.org postfix/qmgr[49108]: warning:
transport r238 failure -- see a previous warning/fatal/panic logfile
record for the problem description
Aug 28 22:08:14 mail0.raystedman.org postfix/master[49106]: warning:
process /usr/libexec/postfix/smtp pid 49124 exit status 1
Aug 28 22:08:14 mail0.raystedman.org postfix/master[49106]: warning:
/usr/libexec/postfix/smtp: bad command startup -- throttling
Aug 28 22:08:14 mail0.raystedman.org postfix/error[49125]:
0B5D085D65D: to=<g...@headingup.net>, relay=none, delay=1.1,
delays=0.1/1/0/0.01, dsn=4.3.0, status=deferred (unknown mail
transport error)

It looks like we tried to use one of the randmap transports (r238)
instead of raystedman: and we are seeing a fatal error.

I can get this to work if I remove the "raystedman:" in sender_relay.regexp.

Aug 28 22:20:04 mail0.raystedman.org postfix/smtpd[49287]: connect
from mail0-p.raystedman.org[xxx.xxx.xxx.174]
Aug 28 22:20:04 mail0.raystedman.org postfix/smtpd[49287]:
AE32785D663: client=mail0-p.raystedman.org[xxx.xxx.xxx.174]
Aug 28 22:20:04 mail0.raystedman.org postfix/cleanup[49291]:
AE32785D663: message-id=<fceb9d1a72d5285837cff4128b663302@swift.generated>
Aug 28 22:20:04 mail0.raystedman.org postfix/qmgr[49282]: AE32785D663:
from=<webmas...@raystedman.org>, size=606, nrcpt=1 (queue active)
Aug 28 22:20:04 mail0.raystedman.org postfix/smtpd[49287]: disconnect
from mail0-p.raystedman.org[10.81.198.174] ehlo=1 mail=1 rcpt=1 data=1
quit=1 commands=5
Aug 28 22:20:05 mail0.raystedman.org r238/smtp[49292]: AE32785D663:
to=<g...@headingup.net>, relay=smtp-relay.gmail.com[142.250.30.28]:25,
delay=0.61, delays=0.1/0.01/0.27/0.23, dsn=2.0.0, status=sent (250
2.0.0 OK  1598671205 w64sm252467qkb.5 - gsmtp)
Aug 28 22:20:05 mail0.raystedman.org postfix/qmgr[49282]: AE32785D663: removed

Here we selected one of the randmap transports (r238) and relayed to
smtp-relay.gmail.com as expected.

So we are still left with binding this sender_relay to a specific ip address.

Thanks, Greg
www.RayStedman.org

Reply via email to