邮件群发集群搭建流程

kevin.Zhu 发布于:2013-11-3 7:58 分类:邮件  有 23 人浏览,获得评论 0 条  

准备工作:
1. 注册超级便宜的域名若干(50)
2. 购买海外低配置VPS($6/3个月) 50个 http://hostus.us
3. 分发秘钥 (auth.sh) 
注:域名需要做好rDNS.

----------------------------- 以下分发命令 -----------------------------
4. 更改远程机ssh端口 (需要分发执行)
sed -i "/#Port\(.*\)/ a Port 60181" /etc/ssh/sshd_config
service sshd restart    #这里最好直接重启机器 reboot  , 不然可能有些机器端口改不了

5.安装postfix
set_domain=$1
set_hostname=$2
yum update -y 
rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update -y 
yum install -y postfix
echo "*    soft    nofile    409600"  >> /etc/security/limits.conf
echo "*    hard    nofile    409600"  >> /etc/security/limits.conf
# reboot
#更新postfix配置文件,使本地可以发送邮件
#如果是分发远程执行,请使用类似: cat ip2.txt | while read host ip; do (ssh -p 60181  root@"$ip"  " sed -i '/^#mydestination.*mydomain$/s/^#//'   /etc/postfix/main.cf  "  & )  ; done
sed -i 's/#myhostname.*/myhostname = '$set_hostname'/'  /etc/postfix/main.cf
sed -i '0,/#mydomain.*/s//mydomain = '$set_domain'/'  /etc/postfix/main.cf
sed -i 's/^#myorigin.*mydomain/myorigin = $mydomain/' /etc/postfix/main.cf
#sed -i 's/^inet_interfaces.*/#&/' /etc/postfix/main.cf
#sed -i '0,/#inet_interfaces.*/s//inet_interfaces = all/'  /etc/postfix/main.cf
sed -i 's/^#inet_protocols/inet_protocols/' /etc/postfix/main.cf
sed -i 's/^mydestination/#mydestination/'  /etc/postfix/main.cf
sed -i '/^#mydestination.*mydomain$/s/^#//'   /etc/postfix/main.cf
sed -i 's/^#mynetworks.*127\.0.*/mynetworks = 127.0.0.0\/8/'   /etc/postfix/main.cf
sed -i 's/^#relay_domains.*/relay_domains =  home_mailbox = Maildir\//' /etc/postfix/main.cf
/etc/init.d/postfix restart
chkconfig postfix on 

6. 安装apache php 
yum install httpd httpd-devel
yum install php php-devel
/etc/init.d/httpd restart

7. 分发service.php到发送机上 
例: 
cat ip2.txt | while read host ip ; do scp -P 60181 send_server/service.php root@"$ip":/var/www/html/ ; done

8. 测试发送 
php send_server/cli_post_mail.php  qq_test.txt   qq_test  300  70  /root/mail/send_server/task/qq6.php 0