Chinaunix首页 | 论坛 | 博客
  • 博客访问: 710865
  • 博文数量: 235
  • 博客积分: 4309
  • 博客等级: 中校
  • 技术积分: 2325
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-17 11:25
个人简介

If you don\\\\\\\\\\\\\\\'t wanna do it, you find an EXCUSE; if you do, you\\\\\\\\\\\\\\\'ll find a WAY :-)

文章分类

全部博文(235)

文章存档

2014年(3)

2013年(2)

2012年(31)

2011年(199)

分类: LINUX

2014-04-27 06:37:23

1>: 安装配置postfix


  1. # apt-get install postfix   (安装postfix)
  2. 或:
  3. # aptitude install postfix

  4. # echo '' >/etc/hostname   (修改主机名)
  5. # echo 'X.X.X.X  www' >> /etc/hosts
  6. # echo 'X.X.X.X ftp.kotzu.org ftp' >> /etc/hosts


  7. # vim /etc/postfix/main.cf
  8. myhostname =            (主机名FQDN)
    alias_maps = hash:/etc/aliases          
    alias_database = hash:/etc/aliases
    myorigin = kotzu.org                    (发件人地址)
    mydestination = , localhost.localdomain    (允许收件的主机)
    relayhost =                       (由于是非公网domain,需要由上游ISP MTA帮忙送信,置空即可!)
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 hash:/etc/postfix/access    (只允许这些地址使用postfix)
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = ipv4
    relay_domains = kotzu.org, localhost
  9. :wq

  10. # vim /etc/postfix/access
    .kotzu.org  OK            (允许此domain使用postfix)
    X.X.X.      REJECT        (拒绝X.X.X.0/24使用postfix)
  11. :wq
  12. # postalias hash:/etc/aliases        (重新生成)
  13. # postmap hash:/etc/postfix/access

  14. # /etc/init.d/postfix reload  (重新加载配置文件)
  15. # /etc/init.d/postfix check   (检查 postfix 相关的配置文件)
    # /etc/init.d/postfix start   (运行 postfix 服务)
    # /etc/init.d/postfix stop    (停止 postfix 服务)

  16. # /usr/sbin/postqueue -p        (查看邮件队列排队的邮件)
  17. 或:
  18. # mailq

  19. /etc/init.d/postfix flush   (强制将目前正在邮件队列排队的邮件寄出)

2>: 自动获取公网地址

  1. # vim /usr/sbin/getPubIP.sh        (编写脚本取得公网IP并mail至相关邮箱)
  2. #!/bin/sh
  3. #Program: save as /usr/sbin/getPubIP.sh
  4. #
  5. DATE=$(date +'%Y-%m-%d %H:%M:%S')
  6. curl ifconfig.me/ip > getip.txt 2>&1
  7. echo $DATE >> getip.txt
  8. tail -2 getip.txt| mail -s 'Today's Public IP Addr' ko@kotzu.org
  9. :wq



3>: 配置 routine

  1. # echo '07 */1 * * * root /usr/sbin/getPubIP.sh' >> /etc/crontab (每间隔1小时执行一次该脚本)


4>: Reserved for future use....

5>: Reserved for future use....

6>: Reserved for future use....

7>: Reserved for future use....


More About Debian :  
More About Postfix: 
阅读(2969) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~