如何让PHP邮件function在Debian上“挤”?

可能重复:
获取PHP邮件()函数在Debian Lenny上工作

我在我的debian服务器上安装了Apache和PHP5

首先我使用sendmail来试用它。 以下是我尝试过的一步一步的程序:

Step 1: apt-get install sendmail Step 2: /etc/init.d/apache2 restart 

但是这不起作用。

然后我尝试使用外部SMTP。 我的域名在BigRock上注册。我在那里注册了邮箱地址[email protected] ,它给了我所需的证书。

在服务器上,我安装了sSMTP

 > apt-get install ssmtp > Configured "/etc/ssmtp/ssmtp.conf" file. 

在我添加的configuration文件中

 [email protected] mailhub=smtp.fostergen.com:587 (Here I have doubt. I am not sure what to use here. I tried smtp.fostergen.com:587, smtp.fostergen.com:25,mx1.mailhostbox.com :587,mx1.mailhostbox.com:25. 

我仍然不确定在这里使用mailhostbox.com。 我使用了mx1.mailhostbox.com,因为它是我在bigrock上的域的mx条目这里是截图![bigrock电子邮件pipe理工具的屏幕截图])

hostname=vs3204.ams2.alvotec.de (我在我的服务器上input了命令hostname -f并将其作为结果)

 FromLineOverride=YES UseSTARTTLS=YES [email protected] AuthPass=password provided during email registration on bigrock > edited /etc/ssmtp/revaliases (added " root:[email protected]:mx1.mailhostbox.com :587 " in the last line) > edited php.ini file (sendmail_path = /usr/sbin/ssmtp -t) > /etc/init.d/apache2 restart 

但是这不起作用。

之后我尝试了eSMTP。 已执行的步骤:

 > apt-get install esmtp > edited /etc/esmtprc hostname=smtp.fostergen.com:587 username= [email protected] password: password provide by bigrock mda="/usr/bin/procmail -d %T" > linked eSMTP to the legacy Sendmail path by execting the command "ln -s /usr/bin/esmtp /usr/bin/sendmail" > edited php.ini file (/usr/bin/sendmail -t -i) > /etc/init.d/apache2 restart 

但是这个技术也失败了。

我只是想通过PHP邮件function发送电子邮件给用户。 请帮助。 我哪里去错了?

它看起来像你的问题是:“我如何在我的专用服务器上安装mta和使用php5”?

因此,有两个步骤:

  • 首先是安装MTA。 如果你不太了解邮件服务器,我build议你使用postfix而不是sendmail:这很容易。 出于安全原因,请确保它只侦听127.0.0.1,因为您不想接收/中继邮件(inet_interfaces = 127.0.0.1在/etc/postfix/main.cf中)。 通过从命令行界面发送电子邮件来testing它的工作原理。 如果没有,请查看日志(/var/log/mail.*)。

  • 第二步是configurationphp使用后缀。 如果我logging正确,默认的debian值是可以开箱的,所以不需要改变。