立即注冊 找回密碼

QQ登錄

只需一步,快速開始

ubuntu下,使用postfix實現(xiàn)php發(fā)送mail功能

2015-3-1 23:41| 發(fā)布者: 學習NO.1| 查看: 529| 評論: 0

摘要: 1、ubuntu 下安裝postfix,執(zhí)行命令:# apt-get install postfix popa3d如果不需要pop3服務(wù),把popa3d去掉2、在php.ini配置文件上,設(shè)置mail函數(shù):1)打開php.ini配置,下面是我的php.ini路徑:# vi /home/service/w ...

1、ubuntu 下安裝postfix,執(zhí)行命令:

# apt-get install postfix popa3d

如果不需要pop3服務(wù),把popa3d去掉

2、在php.ini配置文件上,設(shè)置mail函數(shù):
1)打開php.ini配置,下面是我的php.ini路徑:

# vi /home/service/web/config/php/lib/php.ini


2)找到:sendmail_path ,將其設(shè)置為:


sendmail_path = /usr/sbin/sendmail -t

注意:這里需要先到/usr/sbin/ 目錄中,確認是否存在sendmail文件。

3、啟動postfix:

# /etc/init.d/postfix start

4、重啟apache:

# /etc/init.d/apache2 restart

5、以上完成。你可以寫一個發(fā)送email的php文件做測試,如下:

<?php
$send = mail('yourEmail@test.com', 'My Subject', 'The test mail');
if($send){
echo 'true';
}else{
echo 'false';
}
?>
以上,運行如果顯示true,則,你將會在'yourEmail@test.com'中收到一封主題為'My Subject'的email。

 

如果要限制外來主機訪問smtp服務(wù),修改/etc/postfix/main.cf里的

inet_interfaces=all

inet_interfaces=localhost


鮮花

握手

雷人

路過

雞蛋

最新評論

相關(guān)推薦
!jz_fbzt! !jz_lxwm! !jz_gfqqq!

關(guān)于我們|手機版|小黑屋|地圖|【道勤網(wǎng)】-bmrsportswear.com 軟件視頻自學教程|免費教程|自學電腦|3D教程|平面教程|影視動畫教程|辦公教程|機械設(shè)計教程|網(wǎng)站設(shè)計教程【道勤網(wǎng)】 ( 皖I(lǐng)CP備15000319號-1 )

GMT+8, 2024-10-23 23:24

Powered by DaoQin! X3.4 © 2016-2063 Dao Qin & 道勤科技

返回頂部