简易安装postfix邮件服务器实现PHP发送邮件

1、简要说明
  简易安装postfix邮件服务器 
 2.1、mail:~#apt-get install postfix
安装,根据提示选"Internet Site"
  Where should mail for root go填postfix
  Mail name?填mail.linuxphp.org
  Other destinations to accept mail for?(blank for none)填mail.linuxphp.org, localhost.wjjennleun.com, ,localhost
  Force synchronous updates on mail queue?选否

2.2、检查postfix服务是不是已经运行
  mail:~# netstat -ln|grep 25
 tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
  tcp6 0 0 :::25 :::* LISTEN
  unix 2 [ ACC ] STREAM LISTENING 20256 /tmp/.ICE-unix/11772

2.3、测试postfix
 mail:~# telnet 127.0.0.1 25
  Trying 127.0.0.1...
  Connected to 127.0.0.1.
  Escape character is '^]'.
  220 mail.linuxphp.org ESMTP Postfix (Debian/GNU)
  ehlo mail
  250-mail.linuxphp.org
  250-PIPELINING
  250-SIZE 10240000
  250-VRFY
  250-ETRN
  250 8BITMIME
  mail from: "This is a test mail!"<wxt@linuxphp.org>
  250 Ok
  rcpt to:<wxt@wjjennleun.com>
  250 Ok
  data
  354 End data with <CR><LF>.<CR><LF>
  This is a test mail!
  .
  250 Ok: queued as 4888ACA0060
  quit  221 Bye
  Connection closed by foreign host.
  好象是发出去了噢

2.4、检查刚发的邮件是否收到
mail:~#apt-get install mailx   下载mail阅读器
  mail:~# su - wxt
  wxt@mail~ mail
  No mail for wxt
  wxt@mail:~$exit
  mail:~#:
  my god,没有邮件啊
  mail~:#more /var/mail/wxt
  没有
  mail~:#more /var/spool/mail/wxt
  没有
  咱回事呢
  mail:~# telnet 127.0.0.1 25
  Trying 127.0.0.1...
  Connected to 127.0.0.1.
  Escape character is '^]'.
  220 mail.linuxphp.org ESMTP Postfix (Debian/GNU)
  ehlo mail
  250-mail.linuxphp.org
  250-PIPELINING
  250-SIZE 10240000
  250-VRFY
  250-ETRN
  250 8BITMIME
  mail from: "abc"<wxt>
  250 Ok
  rcpt to: <wxt>
  250 Ok
  data
  354 End data with <CR><LF>.<CR><LF>
  abc
  .
  250 Ok: queued as 609D0CA00BB
  quit
  221 Bye
  Connection closed by foreign host.
  mail:~# more /var/mail/wxt
  From wxt@mail.linuxphp.org Sat Jul 2 18:33:56 2005
  Return-Path: <wxt@mail.linuxphp.org>
  X-Original-To: wxt
  Delivered-To: wxt@mail.linuxphp.org
  Received: from mail (localhost.localdomain [127.0.0.1])
  by mail.linuxphp.org (Postfix) with ESMTP id 609D0CA00BB
  for <wxt>; Sat, 2 Jul 2005 18:33:42 +0800 (CST)
  Message-Id: <20050702103342.609D0CA00BB@mail.linuxphp.org>
  Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)
  From: wxt@mail.linuxphp.org
  To: undisclosed-recipients:;

  abc

  mail:~#
  收到了,此时postfix工作在127.0.0.1上的,也就是localhost
  查看mydestination参数的设定 
  mail:~# postconf |grep mydestination
  mydestination = mail.linuxphp.org, localhost.linuxphp.org, , localhost
  没有wjjennleun.com,所以用wxt@linuxphp.org发信,postfix不会接受,所以要添加linuxphp.org给mydestination
  mail:~# postconf |grep mydestination
  mydestination = mail.linuxphp.org linuxphp.org localhost.linuxphp.org localhost
  现在就可以收到了
  mail:~#>/var/mail/wxt
  mail:~# telnet 127.0.0.1 25
  Trying 127.0.0.1...
  Connected to 127.0.0.1.
  Escape character is '^]'.
  220 mail.linuxphp.org ESMTP Postfix (Debian/GNU)
  ehlo mail
  250-mail.linuxphp.org
  250-PIPELINING
  250-SIZE 10240000
  250-VRFY
  250-ETRN
  250 8BITMIME
  mail from: "abc"<wxt@linuxphp.org>
  250 Ok
  rcpt to: <wxt@linuxphp.org>
  250 Ok
  data
  354 End data with <CR><LF>.<CR><LF>
  abc
  .
  250 Ok: queued as 609D0CA00BB
  quit
  221 Bye
  Connection closed by foreign host.
  mail:~# more /var/mail/wxt
  From wxt@mail.linuxphp.org Sat Jul 2 18:33:56 2005
  Return-Path: <wxt@mail.linuxphp.org>
  X-Original-To: wxt
  Delivered-To: wxt@mail.linuxphp.org
  Received: from mail (localhost.localdomain [127.0.0.1])
  by mail.linuxphp.org (Postfix) with ESMTP id 609D0CA00BB
  for <wxt>; Sat, 2 Jul 2005 18:33:42 +0800 (CST)
  Message-Id: <20050702103342.609D0CA00BB@mail.linuxphp.org>
  Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)
  From: wxt@mail.linuxphp.org
  To: undisclosed-recipients:;
   abc

上一篇: centos + Postfix 电子邮件系统精要   下一篇: debian+extman+postfix+courier+mysql精简配置(亲测)

提交疑问

回顶部