Bạn có 1 hệ thống email với domain là zimilab.com. Bạn nhận được yêu cầu sau:

– Sử dụng dịch vụ lọc spam chuyên nghiệm của Zimico cho các email chiều đến.

– Sử dụng dịch vụ relay của Zimico cho các email chiều đi đến các domain được chỉ định.

Tài liệu tham khảo:

Relay per destination domain
https://sudotoolbox.com/per-domain-destination-based-smtp-route-in-zimbra-8-7/

Sau khi đăng ký dịch vụ relay của Zimico, bạn sẽ nhận được relay account với username và password.

Bạn tiến hành cập nhật DNS:
Hướng nhận, thiết lập MX:

@ mx 10 zimilab-com.p10.mxthunder.com.
@ mx 20 zimilab-com.p20.mxthunder.net.
@ mx 30 zimilab-com.p30.mxthunder.net.
@ mx 40 zimilab-com.p40.mxthunder.net.

Gửi mail test để spamhero xác nhận luồng mail.

Hướng đi, thiết lập SPF

@ txt "v=spf1 ip4:<zimbra server IP> include:spf.mxthunder.com mx ~all"

Thiết lập smtp authentication cho hướng đi, với quyền zimbra.

echo smtp.mxthunder.net:587 <username>:<password> > /opt/zimbra/conf/relay_password
postmap /opt/zimbra/conf/relay_password

Kiểm tra:

postmap -q smtp.mxthunder.net /opt/zimbra/conf/relay_password

Cấu hình zimbra sử dụng username và password này:

zmprov ms `zmhostname` zimbraMtaSmtpSaslPasswordMaps lmdb:/opt/zimbra/conf/relay_password #giá trị mặc định là empty.
zmprov ms `zmhostname` zimbraMtaSmtpSaslAuthEnable yes #giá trị mặc định là no
zmprov ms `zmhostname` zimbraMtaSmtpCnameOverridesServername no #giá trị mặc định là no
zmprov ms `zmhostname` zimbraMtaSmtpTlsSecurityLevel may #giá trị mặc định là may
zmprov ms `zmhostname` zimbraMtaSmtpSaslSecurityOptions noanonymous #giá trị mặc định là noplaintext,noanonymous

Tiến hành reload mta

zmmtactl reload

Cấu hình relay email dựa trên domain người nhận. Bạn muốn khi gửi đến domain domain1.com, domain2.com thì message sẽ được relay qua dịch vụ của zimico (ở đây là smtp.mxthunder.net) qua port 587:

vi /opt/zimbra/common/conf/transport
domain1.com relay:smtp:smtp.mxthunder.net:587
domain2.com relay:smtp:smtp.mxthunder.net:587

Posmap:

postmap /opt/zimbra/common/conf/transport

Lưu ý về permission của file transport.lmdb nếu thấy báo lỗi permission denied.

Cập nhật zimbraMtaTransportMaps

zmprov gs `zmhostname` zimbraMtaTransportMaps
# name xxxx.zimbravn.com
zimbraMtaTransportMaps: proxy:ldap:/opt/zimbra/conf/ldap-transport.cf
zmprov ms `zmhostname` zimbraMtaTransportMaps "lmdb:/opt/zimbra/common/conf/transport,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf"
zmmtactl reload

Mỗi lần cập nhật file transport, bạn cần chạy lại postmap.