Showing posts with label mail. Show all posts
Showing posts with label mail. Show all posts

Thursday, March 21, 2019

ปรับแต่งสคริป send mail alert โดยให้ส่งผ่าน smtp ที่ต้องการ

ปรับแต่งสคริป เพื่อให้ส่งเมลผ่านไปยัง smtp ที่เราทำไว้สำหรับส่งเมล ไม่ให้ส่งออกจากเครื่อง Server นั้น ๆ

สคริป

echo "Check all health hard disk backup complete" | mail -S smtp=IP:PORT -s "Check smart disk on Data Center was completed" -r noreply@domain.com -q /root/checkhealthdisk.txt -v admin@domain.com

คำอธิบาย


  • echo "Check all health hard disk backup complete" ใส่ข้อความเข้าไปในส่วนล่างสุดของเมล
  • mail -S smtp=IP:PORT ใส่ค่า smtp server ที่ต้องการเช่น 192.168.0.2 และพอร์ต 25 ตัวอย่าง 192.168.0.2:25
  • -s "Check smart disk on Data Center was completed" คือ Subject mail
  • -r noreply@domain.com คือ Sender mail
  • -q /root/checkhealthdisk.txt คือ กรณีมีไฟล์ที่ต้องการแนบไปในเมล
  • -v admin@domain.com คือ Receive mail (ผู้ร้บเมล)



Friday, March 31, 2017

configure iRedadmin


Read on install iredmail on debian ubuntu

1. แก้ไข Time/Zone SOGo
#chmod +w /etc/sogo/sogo.conf
#vim /etc/sogo/sogo.conf

SOGoTimeZone = "Asia/Bangkok";

#chmod -w /etc/sogo/sogo.conf

2. configure SSL

Installing TLS Certificate in Postfix and Dovecot


Ref: topic 8813-iredmail-support-timezone

Thursday, June 18, 2015

การกำหนดสิทธ์ให้บางคนส่งเมลออกข้างนอกได้เท่านั้น

สิ่งที่ต้องทำมีดังนี้

1. แก้ไขไฟล์ #vim main.cf
เพิ่มบรรทัดด้านล่าง

smtpd_restriction_classes = external, local_only
external = reject_unauth_destination
local_only = check_recipient_access hash:/etc/postfix/local_domains, reject_unauth_destination
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/restricted_senders

2. สร้างไฟล์ local_domains แล้วแอดโดเมนที่ต้องการให้ส่งเมลออกได้ (ส่วนใหญ่เป็นเมลภายในบริษัท) ดังนี้
#vim local_domains
domain.com  OK
abc.domain.org  OK

บันทึก แล้ว postmap /etc/postfix/local_domains

3. สร้างไฟล์ #vim restricted_senders
เพิ่มข้อมูลดังนี้

บรรทัดที่ 1: ใส่เมลที่ต้องการให้ส่งเมลออกได้
บรรทัดที่ 2: ใส่โดเมนที่ไม่ต้องการให้ส่งเมลออกไป

#vim restricted_senders
abc@domain.com  OK
domain.com  local_only

* สำหรับการเพิ่มเมลคนอื่น ๆ ก็ใส่เพิ่มเข้ามาก่อนบรรทัด domain.com  local_only
เสร็จแล้วรันคำสั่ง
#postmap /etc/postfix/restricted_sendes

4. ให้ตรวจสอบ file /etc/default/saslauthd

# Example: MECHANISMS="pam"
#MECHANISMS="ldap"
PARAMS="-r"
MECHANISMS="rimap -O 192.168.0.xx" (IP Mail server ตัวหลัก)

OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"

5. สุดท้ายสั่ง service postfix ,saslauthd เพื่อใช้งาน
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart

บทความที่เกี่ยวข้อง