Bài viết này sẽ hướng dẫn bạn cách Cấu Hình Relay Email Trên DirectAdmin. Nếu bạn cần hỗ trợ, xin vui lòng liên hệ VinaHost qua Hotline 1900 6046 ext.3, email về support@vinahost.vn hoặc chat với VinaHost qua livechat https://livechat.vinahost.vn/chat.php.
Bước 1: Tạo file exim.routers.pre.conf trong thư mục /etc với nội dung sau:
# vim /etc/exim.routers.pre.conf
relayhost_router:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = "${perl{check_limits}}"
condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
transport = relayhost_transport
route_data = ${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}
Bước 2: Tạo tiếp file exim.transports.pre.conf với nội dung sau:
relayhost_transport:
driver = smtp
port = 25
hosts_require_auth = $host_address
hosts_require_tls = $host_address
headers_add = "${if def:authenticated_id{X-Authenticated-Id: ${authenticated_id}}}" nterface = <; ${if exists{/etc/virtual/domainips}{${lookup{$sender_address_domain}lsearch*{/etc/virtual/domainips}}}}
helo_data = ${if exists{/etc/virtual/helo_data}{${lookup{$sending_ip_address}iplsearch{/etc/virtual/helo_data}{$value}{$primary_hostname}}}{$primary_hostname}}
hosts_try_chunking =
hosts_try_fastopen =
.include_if_exists /etc/exim.dkim.conf
Bước 3: Tạo file exim.authenticators.post.conf để chỉ định file xác thực
auth_login:
driver = plaintext
public_name = LOGIN
client_send = : ${extract{user}{${lookup{$sender_address_domain}lsearch{/etc/access}}}} : ${extract{pass}{${lookup{$sender_address_domain}lsearch{/etc/access}}}}
Bước 4: Restart lại dịch vụ exim
# systemctl restart exim
Bước 5: Tạo và cấu hình 2 file staticroutes và access
- File staticroutes được sử dụng để định tuyến đường relay với cú pháp như sau:
# vim /etc/staticroutes <domain>:<smtp_server>
- File access được sử dụng để xác thực với cú pháp như sau:
# vim /etc/access <domain> user:<username> pass:<password>
Chúc bạn thực hiện cấu hình Relay Email thành công!
THAM KHẢO CÁC DỊCH VỤ TẠI VINAHOST
>> SERVER – COLOCATION – Dịch vụ CDN
>> Thuê Cloud Server – VPS
>> HOSTING
>> WEBSITE
>> TÊN MIỀN
>> GeoTrust SSL – LICENSE