1、ubuntu 下安裝postfix,執(zhí)行命令: # apt-get install postfix popa3d 如果不需要pop3服務(wù),把popa3d去掉 2、在php.ini配置文件上,設(shè)置mail函數(shù): # vi /home/service/web/config/php/lib/php.ini
注意:這里需要先到/usr/sbin/ 目錄中,確認是否存在sendmail文件。 3、啟動postfix: # /etc/init.d/postfix start 4、重啟apache: # /etc/init.d/apache2 restart 5、以上完成。你可以寫一個發(fā)送email的php文件做測試,如下: <?php
如果要限制外來主機訪問smtp服務(wù),修改/etc/postfix/main.cf里的 inet_interfaces=all 為 inet_interfaces=localhost |