-
- # apt-get install postfix (安装postfix)
- 或:
- # aptitude install postfix
-
- # echo '' >/etc/hostname (修改主机名)
- # echo 'X.X.X.X www' >> /etc/hosts
-
# echo 'X.X.X.X ftp.kotzu.org ftp' >> /etc/hosts
-
-
- # vim /etc/postfix/main.cf
-
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 - :wq
-
-
# vim /etc/postfix/access
.kotzu.org OK (允许此domain使用postfix)
X.X.X. REJECT (拒绝X.X.X.0/24使用postfix)
- :wq
- # postalias hash:/etc/aliases (重新生成)
- # postmap hash:/etc/postfix/access
-
- # /etc/init.d/postfix reload (重新加载配置文件)
-
# /etc/init.d/postfix check (检查 postfix 相关的配置文件)
# /etc/init.d/postfix start (运行 postfix 服务)
# /etc/init.d/postfix stop (停止 postfix 服务) -
-
# /usr/sbin/postqueue -p (查看邮件队列排队的邮件)
- 或:
- # mailq
-
-
# /etc/init.d/postfix flush (强制将目前正在邮件队列排队的邮件寄出)
2>: 自动获取公网地址
- # vim /usr/sbin/getPubIP.sh (编写脚本取得公网IP并mail至相关邮箱)
- #!/bin/sh
- #Program: save as /usr/sbin/getPubIP.sh
- #
- DATE=$(date +'%Y-%m-%d %H:%M:%S')
- curl ifconfig.me/ip > getip.txt 2>&1
- echo $DATE >> getip.txt
- tail -2 getip.txt| mail -s 'Today's Public IP Addr' ko@kotzu.org
- :wq
-
3>: 配置 routine
- # 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: