<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="th">
	<id>https://wiki.thnic.or.th/index.php?action=history&amp;feed=atom&amp;title=Freesbsd_-_%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1_-_%E0%B8%AD%E0%B8%98%E0%B8%B4%E0%B8%9A%E0%B8%B2%E0%B8%A2%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%A5%E0%B8%B0%E0%B9%80%E0%B8%AD%E0%B8%B5%E0%B8%A2%E0%B8%94%E0%B8%97%E0%B8%B5%E0%B8%A5%E0%B8%B0%E0%B8%82%E0%B8%B1%E0%B9%89%E0%B8%99%E0%B8%95%E0%B8%AD%E0%B8%99</id>
	<title>Freesbsd - ฉบับเต็ม - อธิบายอย่างละเอียดทีละขั้นตอน - ประวัติรุ่นแก้ไข</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.thnic.or.th/index.php?action=history&amp;feed=atom&amp;title=Freesbsd_-_%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1_-_%E0%B8%AD%E0%B8%98%E0%B8%B4%E0%B8%9A%E0%B8%B2%E0%B8%A2%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%A5%E0%B8%B0%E0%B9%80%E0%B8%AD%E0%B8%B5%E0%B8%A2%E0%B8%94%E0%B8%97%E0%B8%B5%E0%B8%A5%E0%B8%B0%E0%B8%82%E0%B8%B1%E0%B9%89%E0%B8%99%E0%B8%95%E0%B8%AD%E0%B8%99"/>
	<link rel="alternate" type="text/html" href="https://wiki.thnic.or.th/index.php?title=Freesbsd_-_%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1_-_%E0%B8%AD%E0%B8%98%E0%B8%B4%E0%B8%9A%E0%B8%B2%E0%B8%A2%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%A5%E0%B8%B0%E0%B9%80%E0%B8%AD%E0%B8%B5%E0%B8%A2%E0%B8%94%E0%B8%97%E0%B8%B5%E0%B8%A5%E0%B8%B0%E0%B8%82%E0%B8%B1%E0%B9%89%E0%B8%99%E0%B8%95%E0%B8%AD%E0%B8%99&amp;action=history"/>
	<updated>2026-10-23T06:42:11Z</updated>
	<subtitle>ประวัติรุ่นแก้ไขของหน้านี้ในวิกิ</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.thnic.or.th/index.php?title=Freesbsd_-_%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1_-_%E0%B8%AD%E0%B8%98%E0%B8%B4%E0%B8%9A%E0%B8%B2%E0%B8%A2%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%A5%E0%B8%B0%E0%B9%80%E0%B8%AD%E0%B8%B5%E0%B8%A2%E0%B8%94%E0%B8%97%E0%B8%B5%E0%B8%A5%E0%B8%B0%E0%B8%82%E0%B8%B1%E0%B9%89%E0%B8%99%E0%B8%95%E0%B8%AD%E0%B8%99&amp;diff=51&amp;oldid=prev</id>
		<title>Nattawut: Created page with &quot;   &#039;&#039;&#039;การติดตั้ง Postfix สำหรับการเปิดใช้งาน SMTPUTF8, Cyrus SASL และ OpenSSL&#039;&#039;&#039;  == สรุปสาระ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.thnic.or.th/index.php?title=Freesbsd_-_%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1_-_%E0%B8%AD%E0%B8%98%E0%B8%B4%E0%B8%9A%E0%B8%B2%E0%B8%A2%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%A5%E0%B8%B0%E0%B9%80%E0%B8%AD%E0%B8%B5%E0%B8%A2%E0%B8%94%E0%B8%97%E0%B8%B5%E0%B8%A5%E0%B8%B0%E0%B8%82%E0%B8%B1%E0%B9%89%E0%B8%99%E0%B8%95%E0%B8%AD%E0%B8%99&amp;diff=51&amp;oldid=prev"/>
		<updated>2017-02-14T07:14:40Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;   &amp;#039;&amp;#039;&amp;#039;การติดตั้ง Postfix สำหรับการเปิดใช้งาน SMTPUTF8, Cyrus SASL และ OpenSSL&amp;#039;&amp;#039;&amp;#039;  == สรุปสาระ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;หน้าใหม่&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;การติดตั้ง Postfix สำหรับการเปิดใช้งาน SMTPUTF8, Cyrus SASL และ OpenSSL&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== สรุปสาระสำคัญของ mail server  ==&lt;br /&gt;
คู่มือนี้ใช้สำหรับการติดตั้ง mail server ที่สามารถรับ mail ที่เป็น SMTPUTF8 ได้ นอกจากนี้ยังป้องการการตีกลับของอีเมลหากผู้ส่งส่งไปยัง mail server&lt;br /&gt;
&lt;br /&gt;
ที่ไม่รองรับ SMTPUTF8 รวมถึง IMAP และ POP3 ที่ใช้ Courier ด้วย ผู้ใช้จะถูกเพิ่มเป็น local user ถึงแม้ว่าจะ login ผ่าน SSH หรือไม่ก็ตาม mail ทั้งหมดจะถูกเก็บไว้ที่ /home/user&lt;br /&gt;
&lt;br /&gt;
Squirrel-mail ที่ถูกแก้ไขนี้จะถูกติดตั้งในการส่งและรับ email (จะต้องมีการทดสอบ)&lt;br /&gt;
&lt;br /&gt;
email client สามารถนำมาใช้ได้ โดยใช้ username ที่ไม่ได้เป็น EAI address&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ใช้ Freebsd 10.2&lt;br /&gt;
&lt;br /&gt;
== ข้อสังเกต ความต้องการและการตั้งค่าเริ่มต้น ==&lt;br /&gt;
&lt;br /&gt;
* คุณจะต้องไม่มีการติดตั้ง Postfix ซึ่งต้องไม่ต่ำกว่าเวอรชั่น 3.0&lt;br /&gt;
* ถ้าคุณได้ติดตั้งส่วนเสริมของ mail software หลังจากการติดตั้ง คุณต้องทดสอบให้แน่ใจว่า server ของคุณสามารถส่งกลับมาเป็น SMTPUTF8&lt;br /&gt;
* DNS ของคุณควรต้องติดตั้งให้พร้อมก่อนการตั้งค่า&lt;br /&gt;
* hostname คือ ชื่อโดเมนของคุณ เช่น domain.com &lt;br /&gt;
* mail.hostname คือ ชื่อ Mail server ของคุณ เช่น mail.domain.com&lt;br /&gt;
* ใช้ user root (sudo privileges) ทำงานกับ Server FreeBSD&lt;br /&gt;
* การติดตั้งนี้เป็นการติดตั้งผ่าน user root เว้นแต่จะระบุไว้เป็นอย่างอื่น&lt;br /&gt;
&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;แก้ไข hostname &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;#039;&amp;#039;ถ้าคุณใช้ international domain ให้คุณใช้ในรูปแบบ punycode&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
ตัวอย่าง: mail.วีคลาส.ไทย punycode equivalent ควรจะเป็น mail.xn--42c0eeo3bp.xn--o3cw4h&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/hostname&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
แก้ไขเป็นชื่อ hostname ที่คุณต้องการ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mail.domain.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ปิดและเปิด server ใหม่ เพื่อปรับปรุง hostname&lt;br /&gt;
&lt;br /&gt;
หลังจากปิดและเปิด server ใหม่แล้ว ให้ใช้คำสั่งต่อไปนี้จะแสดง hostname เพื่อดูว่า hostname เปลี่ยนแล้ว&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hostname&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ติดตั้ง Postfix จาก source และ libraries ที่จำเป็น (Cyrus  SASL, OPENSSL)  ==&lt;br /&gt;
&lt;br /&gt;
ใช้คำสั่ง get เพื่อดาวน์โหลด Postfix เวอร์ชั่น 3.0.1 หรือเวอร์ชั่นที่ใหม่กว่าเพื่อเปิดใช้งาน SMTPUTF8 คุณสามารถโหลดได้จาก http://www.postfix.org/download.html ในตัวอย่างด้านล่าง เราดาวน์โหลด postfix-3.0.1.tar.gz เวอร์ชั่นของคุณอาจจะแตกต่างออกไป ขณะนี้การติดตั้ง Postfix ด้วย apt-get นั้นจะทำการติดตั้ง Postfix เวอร์ชั่นเก่าที่ยังไม่รองรับ SMTPUTF8  ซึ่งอาจจะมีการเปลี่ยนแปลงในภายหลัง&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ติดตั้ง libraries ที่จำเป็นด้วยตัวเลือกพอร์ตอัตโนมัติ&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /usr/ports/security/openssl &lt;br /&gt;
make &amp;amp;&amp;amp; make install&lt;br /&gt;
&lt;br /&gt;
cd /usr/ports/security/cyrus-sasl2&lt;br /&gt;
make &amp;amp;&amp;amp; make install&lt;br /&gt;
&lt;br /&gt;
cd /usr/ports/devel/icu&lt;br /&gt;
make &amp;amp;&amp;amp; make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Refresh your environment &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
สร้าง user และ directory ownership ที่จำเป็น&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pw groupadd postfix -g 32 &lt;br /&gt;
pw groupmod mail -m postfix&lt;br /&gt;
pw groupadd postdrop &lt;br /&gt;
pw useradd postfix -c &amp;quot;Postfix Daemon User&amp;quot; -d /var/spool/postfix -g postfix  -s /bin/false -u 32  &lt;br /&gt;
chown -v postfix:postfix /var/mail&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ดาวน์โหลด Postfix 3.0.1 หรือเวอร์ชั่นที่ใหม่กว่า และ Compile ด้วย openssl และ sasl auth  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar -xzvf postfix-3.0.1.tar.gz&lt;br /&gt;
cd postfix-3.0.1&lt;br /&gt;
make CCARGS=&amp;quot;-DUSE_TLS -I/usr/include/openssl/   -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/include/sasl&amp;quot; AUXLIBS=&amp;quot;-lssl -lcrypto -lsasl2&amp;quot; makefiles &lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ติดตั้ง Postfix&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sh postfix-install -non-interactive   daemon_directory=/usr/lib/postfix  \&lt;br /&gt;
                    manpage_directory=/usr/share/man  \&lt;br /&gt;
                    html_directory=/usr/share/doc/postfix-3.0.1/html  \&lt;br /&gt;
                    readme_directory=/usr/share/doc/postfix-3.0.1/readme&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
แก้ไขไฟล์ /etc/rc.conf&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postfix_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
sendmail_enable=&amp;quot;NO&amp;quot;&lt;br /&gt;
sendmail_submit_enable=&amp;quot;NO&amp;quot;&lt;br /&gt;
sendmail_outbound_enable=&amp;quot;NO&amp;quot;&lt;br /&gt;
sendmail_msp_queue_enable=&amp;quot;NO&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
แก้ไขไฟล์ /etc/periodic.conf &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
daily_clean_hoststat_enable=&amp;quot;NO&amp;quot;&lt;br /&gt;
daily_status_mail_rejects_enable=&amp;quot;NO&amp;quot;&lt;br /&gt;
daily_status_include_submit_mailq=&amp;quot;NO&amp;quot;&lt;br /&gt;
daily_submit_queuerun=&amp;quot;NO&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
หยุดการทำงาน sendmail และเปิดการใช้งาน postfix&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
service sendmail stop&lt;br /&gt;
postfix start&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== การตั้งค่า Postfix ==&lt;br /&gt;
&lt;br /&gt;
แก้ไข mail.domain.tld, domain.tld, yourotherdomain.tld (yourotherdomain.tld ไม่จำเป็นต้องใส่ก็ได้)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;vim&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;myhostname  = mail.domain.tld&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;mydomain    = domain.tld&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;myorigin    = $mydomain&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;inet_interfaces = all&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;alias_database = hash:/etc/aliases&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;alias_maps = hash:/etc/aliases&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, yourotherdomain.tld&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtputf8_enable = yes&amp;#039;&lt;br /&gt;
postfix reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@TODO &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Enable Postfix as service and run at startup&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ลองใช้งานและส่ง mail โดยใช้ Telnet ส่ง mail ไปยัง server อื่นๆ เช่น gmail&lt;br /&gt;
&lt;br /&gt;
== ทดสอบว่าคุณมีการเปิดการใช้งาน SMTPUTF8 หรือไม่ ==&lt;br /&gt;
&lt;br /&gt;
ป้อนคำสั่งในหน้า console ซึ่งคำสั่งจะทำการเชื่อมต่อไปยัง SMTP&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 telnet localhost 25&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ควรจะแสดงผลลัพธ์ดังนี้&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Trying 127.0.0.1...&lt;br /&gt;
Connected to localhost.&lt;br /&gt;
Escape character is &amp;#039;^]&amp;#039;.&lt;br /&gt;
220 YourHostName ESMTP Postfix&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
พิมพ์คำสั่งด้านล่างแล้วกด enter&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
EHLO localhost&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
เมื่อพบว่ามี &amp;#039;&amp;#039;&amp;#039;250 SMTPUTF8&amp;#039;&amp;#039;&amp;#039; อยู่ แสดงว่า server ของคุณ สามารถรับและส่ง mail จากที่อยู่ email สากลได้&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
250-YourHostName&lt;br /&gt;
250-PIPELINING&lt;br /&gt;
250-SIZE 10240000&lt;br /&gt;
250-VRFY&lt;br /&gt;
250-ETRN&lt;br /&gt;
250-ENHANCEDSTATUSCODES&lt;br /&gt;
250-8BITMIME&lt;br /&gt;
250-DSN&lt;br /&gt;
250 SMTPUTF8&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
หากไม่พบ 250 SMTPUTF8 ให้ลองเอา Postfix ออกและลองใหม่อีกครั้ง เพราะอาจจะมีการติดตั้งส่วนเสริม software ของ Postfix ที่เป็นตัวเก่าเหลืออยู่&lt;br /&gt;
&lt;br /&gt;
==เปิดใช้งาน SMTP Auth  ==&lt;br /&gt;
&lt;br /&gt;
ติดตั้ง saslauthd ด้วยตัวเลือกอัตโนมัติ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /usr/ports/security/cyrus-sasl2-saslauthd&lt;br /&gt;
make &amp;amp;&amp;amp; make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
แก้ไขไฟล์ /etc/rc.conf&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
saslauthd_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
สร้าง หรือ แก้ไขไฟล์ /usr/local/lib/sasl2/smtpd.conf ใช้เฉพาะวิธีการแบบ PLAIN เท่านั้น&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pwcheck_method: saslauthd&lt;br /&gt;
mech_list: PLAIN LOGIN&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ปรับปรุงการตั้งค่า Postfix&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo postconf -e &amp;#039;smtpd_sasl_path = smtpd&amp;#039;&lt;br /&gt;
sudo postconf -e &amp;#039;smtpd_sasl_auth_enable = yes&amp;#039;&lt;br /&gt;
service saslauthd start&lt;br /&gt;
sudo postfix reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
สร้าง user ที่เราสามารถทดสอบการ authentication ได้ แทนที่ AnyUserName ด้วย user ของคุณ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo useradd -m AnyUserName  -s /usr/sbin/nologin&lt;br /&gt;
sudo passwd AnyUserName &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
สร้าง Auth key ของคุณ แทนที่ username ด้วย username  ของคุณ และแทนที่ password ด้วย password ของคุณ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
perl -MMIME::Base64 -e &amp;#039;print encode_base64(&amp;quot;\000username\000yourpassword&amp;quot;)&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
แทนที่ dGVzdAB0ZXN0AHRlc3Q=  ด้วย key ที่คุณสร้างขึ้น&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
telnet 	localhost 25&lt;br /&gt;
EHLO localhost&lt;br /&gt;
AUTH PLAIN dGVzdAB0ZXN0AHRlc3Q=	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
คุณควรจะได้รับข้อความว่า  Authentication successful&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Known Error:&amp;#039;&amp;#039;&amp;#039; ถ้า base64 encode ของคุณมี == ด้านท้ายสองอัน  มันอาจจะไม่ได้รับการยอมรับจาก terminal  ดังนั้นคุณควรใช้ password ที่จะไม่ให้ผลลัพธ์ออกมาเป็น == สองอันด้านท้าย&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
จบการตั้งค่า Postfix ด้วยการอนุญาติให้เฉพาะผู้ใช้ที่ทำการ authenticate ทำการส่งไปยัง SMTP ได้&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;broken_sasl_auth_clients = yes&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_sasl_security_options = noanonymous&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_sasl_local_domain = $mydomain&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_relay_restrictions =  permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_sender_login_mismatch &amp;#039;&lt;br /&gt;
postfix reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== เปิดใช้งาน TLS ==&lt;br /&gt;
&lt;br /&gt;
สร้าง certificates&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /etc/postfix&lt;br /&gt;
&lt;br /&gt;
openssl req -new -outform PEM -out smtpd.cert \&lt;br /&gt;
   -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM \&lt;br /&gt;
   -days 365 -x509&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ตอบคำถามต่อไปนี้เมื่อได้รับแจ้ง&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ปรับปรุงการตั้งค่า Postfix&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;smtpd_enforce_tls = no&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_security_level = may&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_loglevel = 1&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_use_tls = yes&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_key_file  = /etc/postfix/smtpd.key&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_cert_file  = /etc/postfix/smtpd.cert&amp;#039;&lt;br /&gt;
postfix reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
สามารถทดสอบโดยการ telnet ไปยัง 25 และใช้คำสั่ง EHLO จะพบคำว่า STARTTLS&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
250-PIPELINING&lt;br /&gt;
250-SIZE 10240000&lt;br /&gt;
250-VRFY&lt;br /&gt;
250-ETRN&lt;br /&gt;
250-STARTTLS&lt;br /&gt;
250-AUTH PLAIN LOGIN&lt;br /&gt;
250-AUTH=PLAIN LOGIN&lt;br /&gt;
250-ENHANCEDSTATUSCODES&lt;br /&gt;
250-8BITMIME&lt;br /&gt;
250-DSN&lt;br /&gt;
250 SMTPUTF8&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
พิมพ์คำสั่งด้านล่าง&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
STARTTLS&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ปรากฎผลลัพธ์ดังนี้&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
220 2.0.0 Ready to start TLS&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== การส่งและรับ email จากอินเทอร์เน็ต ==&lt;br /&gt;
&lt;br /&gt;
การส่ง email ด้วย telnet&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
telnet localhost 25&lt;br /&gt;
EHLO localhost&lt;br /&gt;
&lt;br /&gt;
MAIL FROM: &amp;lt;youruser@domain.tld&amp;gt; SMTPUTF8&lt;br /&gt;
RCPT FROM: &amp;lt;EAI@IDN.idn&amp;gt;&lt;br /&gt;
data&lt;br /&gt;
Subject: A Test&lt;br /&gt;
&lt;br /&gt;
This is the body&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ใช้เครื่องหมาย &amp;quot;.&amp;quot; เพื่อจบข้อความและทำการส่งข้อความ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ในส่วนนี้โปรดตรวจสอบให้แน่ใจว่าสามารถรับและส่ง mail ได้&lt;br /&gt;
&lt;br /&gt;
สามารถส่งข้อความด้วย EAI address และตรวจสอบได้ที่ /var/mail/mail.log ใน log ด้านล่าง &lt;br /&gt;
&amp;lt;br/&amp;gt; หมายเหตุ test@domain.tld คือ ผู้รับ local&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Aug  3 02:48:49 ip-172-31-21-209 postfix/local[21614]: 7EAD343550: to=&amp;lt;test@domain.tld&amp;gt;, relay=local, delay=0.62, delays=0.62/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)&lt;br /&gt;
Aug  3 02:48:49 ip-172-31-21-209 postfix/qmgr[21586]: 7EAD343550: removed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
email จะถูกจัดเก็บไว้ที่ /var/mail/&lt;br /&gt;
&lt;br /&gt;
หากไม่ได้รับ email ให้ลองใช้เครื่องมือ online อื่น เช่น mxtoolbox.com เพื่อตรวจสอบปัญหาที่เกิดขึ้น&lt;br /&gt;
&lt;br /&gt;
== การตั้งค่า Courier authlib, Courier IMAP ==&lt;br /&gt;
ขั้นตอนนี้จะทำการเปิดใช้งาน IMAP และ POP3 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /usr/ports/security/courier-authlib&lt;br /&gt;
make &amp;amp;&amp;amp; make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd  /usr/ports/mail/courier-imap&lt;br /&gt;
make &amp;amp;&amp;amp; make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
แก้ไขไฟล์ /usr/local/etc/authlib/authdaemonrc และเปลี่ยนค่า authentication method&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
authmodulelist=&amp;quot;authpam&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
แก้ไขไฟล์ /etc/rc.conf&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
courier_authdaemond_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
courier_imap_imapd_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
courier_imap_imapd_ssl_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
courier_imap_pop3d_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
courier_imap_pop3d_ssl_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
ตั้งค่า Postfix ให้ใช้ Maildir เป็นที่เก็บ Mail&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;home_mailbox = Maildir/&amp;#039;&lt;br /&gt;
service courier-authdaemond start&lt;br /&gt;
service courier-imap-imapd&lt;br /&gt;
service courier-imap-imapd-ssl&lt;br /&gt;
service courier-imap-pop3d&lt;br /&gt;
service courier-imap-pop3d-ssl&lt;br /&gt;
&lt;br /&gt;
service courier-imap-imapd start&lt;br /&gt;
service courier-imap-imapd-ssl start&lt;br /&gt;
service courier-imap-pop3d start&lt;br /&gt;
service courier-imap-pop3d-ssl start&lt;br /&gt;
postfix reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ปรับเปลี่ยน Skeleton และสร้างโฟลเดอร์สำหรับผู้ใช้งานที่เราสร้างขึ้นก่อนหน้านี้ จากในตัวอย่างเราใช้ชื่อผู้ใช้งาน test&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p /usr/share/skel/Maildir/{cur,new,tmp}&lt;br /&gt;
&lt;br /&gt;
mkdir -p /home/test/Maildir/{cur,new,tmp}&lt;br /&gt;
chown test:test /home/test/Maildir/{,cur,new,tmp}&lt;br /&gt;
chmod 0700 /home/test/Maildir/{,cur,new,tmp}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ทดสอบ IMAP และ POP3 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
telnet localhost imap&lt;br /&gt;
ok login username password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
telnet localhost pop3&lt;br /&gt;
User username&lt;br /&gt;
Pass password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ติดตั้ง Squirrel-mail ==&lt;br /&gt;
&lt;br /&gt;
ติดตั้งและแก้ไข Squirrel mail&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd to-your-public-html-filder&lt;br /&gt;
wget http://interlab.ait.ac.th/eai-wiki/files/squirrelmail.zip&lt;br /&gt;
unzip squirrelmail.zip&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
แก้ไขไฟล์ config และเปลี่ยนค่า &amp;#039;&amp;#039;&amp;#039;attachchment_dir&amp;#039;&amp;#039;&amp;#039; และ &amp;#039;&amp;#039;&amp;#039;data_dir&amp;#039;&amp;#039;&amp;#039; โดยอย่าลืมสร้างโฟลเดอร์&lt;br /&gt;
เปลี่ยน ownership เป็น &amp;#039;&amp;#039;&amp;#039;apache user&amp;#039;&amp;#039;&amp;#039; ของคุณและอนุญาติให้สามารถทำการเขียนได้&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi squirrelmail/config/config.php &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
การเข้าถึง squirrelmail&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
http://your-domain/squirrelmail/&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ลิงค์ที่เกี่ยวข้อง ==&lt;br /&gt;
Mail server จะไม่รับและส่ง email จากภายนอก&lt;br /&gt;
&lt;br /&gt;
== แหล่งที่มา ==&lt;br /&gt;
&lt;br /&gt;
http://postfix.org/&lt;/div&gt;</summary>
		<author><name>Nattawut</name></author>
	</entry>
</feed>