Image does not exist: https://previews.123rf.com/images/magadesigns/magadesigns1402/magadesigns140200008/26108348-Illustration-art-of-a-system-send-mail-logo-with-isolated-background-Stock-Vector.jpg
Sendmail ເປັນຊອບແວໄວ້ສົ່ງອີເມລໃນ ລີນຸກ, ຖ້າເຊິເວີເຮົາຕ້ອງການສົ່ງເມລ ໂດຍໃຊ້ Function mail()ໃນ PHP ມີວິທີການຕິດຕັ້ງດັ່ງນີ້
1. ຕິດຕັ້ງ
sudo apt-get install sendmail
2. ປັບປຸງ Hosts file
sudo nano /etc/hosts
ລັກສະນະແບບນີ້
127.0.1.1 yourhost yourhost 127.0.0.1 localhost
ໃຫ້ເພີ່ມແບບນີ້ໃນແຖວ 2
127.0.0.1 localhost localhost.localdomain yourhost
ແລ້ວບັນທຶກໄວ້
3. ຣັນ sendmailconfig
sudo sendmailconfig
ແລະ
sudo service apache2 restart
ຈົບ ສຳລັບຕີດຕັ້ງ sendmail
ຕໍ່ມາ ຖ້າເຮົາຢາກໃຫ້ສົ່ງເມລ ຜ່ານ Smarthost
ມີວິທີຄື
1. ກ່ອນອື່ນຕ້ອງໄປສ້າງໄຟລ /etc/mail/auth/client-info
ແລ້ວໃສ່ຂໍ້ມູນຄື
AuthInfo:<smarthost> "U:<username>" "I:<account>" "P:<password>"
<smarthost> is the fully qualified domain name (fqdn) of your smarthost
<username> is the userid used to login at the smarthost (often your email address)
<account> is the account to be used for your smarthost (often your email address as well)
<password> is the password that belongs to your smarthost username
ຫລັງຈາກນັ້ນ ສ້າງລະຫັດກັບ hash ດ້ວຍຄຳສັ່ງນີ້
sudo bash -c "cd /etc/mail/auth/ && makemap hash client-info < client-info"
2. ແກ້ໄຂໄຟລ /etc/mail/sendmail.mc
ໃຫ້ຄົ້ນຫາແຖວທີ່ຂື້ນຕົ້ນດ້ວຍ MAILER_DEFINITIONS ແລ້ວໃສ່ຂໍ້ມູນຂ້າງລຸ່ມນີ້ໃສ່ກ່ອນ
define(`SMART_HOST', <smarthost>)dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(`authinfo', `hash /etc/mail/auth/client-info')dnl
3. ໃຊ້ M4 macro processor ເພື່ອແປຈາກ /etc/mail/sendmail.mc ໄປເປັນແບບ sendmail ໃຫ້ເຂົ້າໃຈ (/etc/mail/sendmail.cf)
sudo bash -c "cd /etc/mail/ && m4 sendmail.mc > sendmail.cf"
ຫລັງຈາກນັ້ນ Restart sendmail ເພື່ອກວດສອບການຕັ້ງຄ່າທັງໝົດ
sudo /etc/init.d/sendmail restart
ຈົບແລ້ວ.
[tag]Sendmail, Linux[/tag]