View Single Post
Tuổi 12-05-2010, 03:05 PM   #2
emailhoc
Administrator
 
Gia nhập: Jul 2009
Trả Lời: 245
Bạn làm như sau nhé:

Bước 1: Cấu hình file /etc/postfix/main.cf như sau:

Mã:
smtpd_restriction_classes = allowed_only
allowed_only = check_recipient_access hash:/etc/postfix/allowed_domains, reject

smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/restricted_senders, permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
Bước 2: Tạo tập tin /etc/postfix/restricted_senders chứa tên các hộp thư cần cấu hình (trong TH này là: sender1) có nội dung như sau:

Mã:
sender1@abc.com allowed_only
Bước 3: Tạo tập tin /etc/postfix/allowed_domains chứa các tên miền cho phép gửi mail tới, có nội dung:

Mã:
yahoo.com OK
quantrinet.com OK
Bước 4: Chạy postmap hai file vừa tạo để cập nhật Postfix

Mã:
# postmap  /etc/postfix/restricted_senders 
# postmap /etc/postfix/allowed_domains
Bước 5: Khởi động lại dịch vụ Postfix: service postfix restart

Bước 6: Đến đây thì yêu cầu đã được thực hiện thành công khi sử dụng các phần mềm Mail Client để test

Tuy nhiên, nếu dùng webmail (VD như Horde) thì cần phải chuyển kiểu gửi mail ra ngoài từ "sendmail" thành "smtp" bằng cách:

Mở file horde.php hoặc đối với Plesk là /etc/psa-webmail/horde/horde/conf.php để sửa giá trị $conf['mailer']['type'] từ sendmail thành smtp
emailhoc vắng mặt   Trả lời ngay kèm theo trích dẫn này
The Following User Says Thank You to emailhoc For This Useful Post: