Heim  >  Artikel  >  php教程  >  Mac OSX 配置PHP Mail

Mac OSX 配置PHP Mail

WBOY
WBOYOriginal
2016-06-06 20:11:441581Durchsuche

我们将实现以下功能点: 如何让自己的Mac电脑能成为一个localhost mail server(本地邮件服务器),能直接发送邮件; 在Mac OSX 系统实现PHP mail() function 的功能; 修改PHP的主要配置文件php.ini 文件,开启在类Unix系统下PHP mail() function的发送邮件

我们将实现以下功能点:

  1. 如何让自己的Mac电脑能成为一个localhost mail server(本地邮件服务器),能直接发送邮件;
  2. 在Mac OSX 系统实现PHP mail() function 的功能;

Mac OSX PHP Mail Postfix

修改PHP的主要配置文件php.ini 文件,开启在类Unix系统下PHP mail() function的发送邮件功能:

sendmail_path = “env -i /usr/sbin/sendmail -t -i”

然后重启Apache服务器或者Nginx服务器等。

开启邮件服务

发送邮件主要由Mail Transfer Agent (MTA) 邮件传输代理来实现,常用的MTA有PostfixSendmail等。

然而MAC OSX 系统 已经预装了Postfix服务,我们就不需要再安装一次了,直接开启就OK了。

$ sudo postfix start
postfix/postfix-script: starting the Postfix mail system

查看Postfix是否启动了,只需查看一下进程是否创建了。

lixi$ ps -ef | grep postfix
0 45793???? 1?? 0? 5:50下午 ?????????? 0:00.03 /usr/libexec/postfix/master

查看Postfix安装在哪儿?

$ which postfix
/usr/sbin/postfix

测试Postfix是否能成功代理发送邮件

$ date | mail -s testing name@gmail.com

查看邮件发送队列

$ mailq
-Queue ID- –Size– —-Arrival Time—- -Sender/Recipient——-
9E7D8276E30*???? 369 Sun Feb 23 18:39:42? user@userdeMacBook-Pro.local
name@gmail.com

打开Gmail查看是否存在testing标题的邮件。

(...)
Read the rest of Mac OSX 配置PHP Mail (27 words)


© Li Xi for LixiPHP, 2014. | Permalink | No comment | Add to del.icio.us
Post tags: Function, Mac, mail, OSX, Postfix, 邮件服务器

Feed enhanced by Better Feed from Ozh

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn