#!/bin/bash

### <=================================================================================================> ###
### CentOS installer -6X x86_64 = Version 2019  $ Wed Oct 28 13:08:14 GMT === > ###
### Information: http://www.NewtonPMTA.com or e- mail: kingslowburn@protonmail.com ===========> ### 
### <=================================================================================================> ###

rm -rf /root/1centosupdate.sh
rm -rf /root/2dnsupdate.sh
rm -rf /root/3repoupdate.sh
rm -rf /root/4dbintil.sh
rm -rf /root/5intrspr.sh
rm -rf /root/6ipconfig.sh
rm -rf /root/7coreupdate.sh
rm -rf /root/8mtamaster.sh
rm -rf /root/9proxysetup.sh
rm -rf /root/10dmarcsys.sh
rm -rf /root/11dkimpuyr.sh
rm -rf /root/12spfupdate.sh
rm -rf /root/NewtonPMTAv5.sh
rm -rf /root/installv5.sh
rm -rf /root/NPMTAInstallv5.sh
rm -rf /root/newtonpmtav5.zip

yum install -y mailx

mkdir -p /root/newtonpmta-scripts/backup-local/.Originais

echo "
### <==========================================================================================> ###
### <=================== SCRIPT CREATED BY WWW.NewtonPMTA.com  ============================>###
Step 1 ### ---> Preparing installation CentOS 6 X86_64 = DATA ================================> ###
### <==========================================================================================> ###
"

ConfIps=`ip a | grep 'inet ' | awk '{print $2}' | cut -f1 -d/ | grep -v ^127.[0-9] | grep -v ^10.[0-9] | grep -v ^192.168.[0-9] | grep -v ^172.16.[0-9]`
echo "$ConfIps" > /root/newtonpmta-scripts/ips.info
Ips=`cat /root/newtonpmta-scripts/ips.info`
IpPrinc=`head -1 /root/newtonpmta-scripts/ips.info`
IpsQuant=`cat /root/newtonpmta-scripts/ips.info | wc -l`

echo "search 208.67.222.222 8.8.8.8
nameserver 208.67.222.222
nameserver 8.8.8.8
" > /etc/resolv.conf

rm -rf /etc/localtime
echo 'ZONE=America/Chicago
UTC=false
ARC=false' > /etc/sysconfig/clock
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime

echo "
### ---> Collecting information to Setup Your Email Server, please answer :
### <=========================================================================================> ###"

echo "
Please enter your purchase email address (This is used to check you have a valid license to use this tool) "
read LicenseEmail
echo $LicenseEmail > /root/newtonpmta-scripts/licenseemail.info

echo "
Please enter your Password (This is used to check you have a valid license to use this tool) "
read LicensePassword
echo $LicensePass > /root/newtonpmta-scripts/licenseepass.info

echo "
Please enter the domain to be configured on this server (no http or www) ex. newtonpmta.com : "
read Domain
echo $Domain > /root/newtonpmta-scripts/domain.info
Hostname=server.$Domain
echo $Hostname > /proc/sys/kernel/hostname

echo "
Please enter a word , letter or term that will serve as reverseDNS, eg mail, mta, rdns  NOTE = Do not use numbers! "
read ReverseDNS
echo $ReverseDNS > /root/newtonpmta-scripts/reversedns.info
echo "
Configured domains ! "

echo "
Please enter your MySQL password you want to use: "
read sqlpass
echo $sqlpass > /root/newtonpmta-scripts/sqlpass.info

echo "
User Configuration: "

echo "
Please enter your first name: "
read firstname
echo $firstname > /root/newtonpmta-scripts/firstname.info

echo "
Please enter your last name: "
read lastname
echo $lastname > /root/newtonpmta-scripts/lastname.info

echo "
Please enter your admin login email address: "
read adminemail
echo $adminemail > /root/newtonpmta-scripts/adminemail.info

echo "
Please enter your SMTP username? example: sales"
read SendingUser
SendingUserPass=$(echo vip$(date | md5sum | cut -c -12))
SendingUserPassMysql=$(echo -ne $SendingUserPass | base64)
useradd $SendingUser 
echo $SendingUser:$SendingUserPass | chpasswd
mkdir /home/$SendingUser/websites
chmod 755 /home/$SendingUser/ -R
chown $SendingUser:$SendingUser /home/$SendingUser/ -R
echo $SendingUser > /root/newtonpmta-scripts/sendinguser.info
echo $SendingUserPass > /root/newtonpmta-scripts/sendinguserpass.info

useradd return -s /sbin/nologin
echo return:return*p5348*vip | chpasswd

useradd admin 
echo admin:admin*p5347*vip | chpasswd

useradd fbl 
echo fbl:fbl*p5348*vip | chpasswd

useradd abuse 
echo abuse:abuse*p5348*vip | chpasswd

useradd reply
echo reply:reply*p5348*vip | chpasswd

useradd postmaster
echo postmaster:postmaster*p5348*vip | chpasswd

echo "
What is the external email to receive email monitoring of this server and replies from email campaigns? "
read MonitoringEmail
echo $SendingUser $MonitoringEmail > /root/newtonpmta-scripts/monitoringemail.info

echo "
Monitoring emails are directed to $MonitoringEmail ! "

echo "
This server will perform daily backups of applications and store the copy of the last 7 days
Still want to configure Backup FTP service once a week ? (yes/no)"
read BackupFtp

if [ $BackupFtp = yes ]
then
	echo "I would like to install the backup to the standard ftp server? (yes/no)"
	read ServFtp
	if [ $ServFtp = yes ]
	then 
		HostFtp='ftp.xxxxxx.com'
		echo $HostFtp > /root/newtonpmta-scripts/hostftp.info
		UserFtp='ftpbck@xxxxxx.com'
		echo $UserFtp > /root/newtonpmta-scripts/userftp.info
		UserPassFtp='xxxxxxxxxx'
		echo $UserPassFtp > /root/newtonpmta-scripts/userpassftp.info
	else
		echo "Data required for the configuration of the backup: "
		echo "What is the FTP destination address?"
		read HostFtp
		echo $HostFtp > /root/newtonpmta-scripts/hostftp.info

		echo "What is the FTP username in $HostFtp?"
		read UserFtp
		echo $UserFtp > /root/newtonpmta-scripts/userftp.info

		echo "What is the valid password of the user ftp $UserFtp ?" 
		read UserPassFtp
		echo $UserPassFtp > /root/newtonpmta-scripts/userpassftp.info
	fi
	echo "
On what day of the week you want the backup to be performed since Monday is day 1, Wednesday is day 3 and day 7 is Sunday.
Indicate with a number eg 1, what day of the week the FTP Backup must be configured: Attention: (1-7)"
	read Dftp
	echo "
At what time of day you want the backup to be performed since midnight is 00,
three in the morning is 03, two in the afternoon is 14 ...
Indicate by decimal 00 to 23 which time of the day the backup FTP must be configured :
Please note: ( 00-23 )"
	read Hftp
else 
	echo "
	The FTP backup system will not be configured. "
fi

echo "
Do you want to configure the user $SendingUser in mysql with external access ? (yes/no)"
read MysqlUserExt

if [ $MysqlUserExt = yes ]
then
	MysqlBind=0.0.0.0
else
	MysqlBind=127.0.0.1
fi 	

echo "
Do you want to set up a special port for ssh ? (yes/no)"
read SshEsp

if [ $SshEsp = yes ]
then
	echo "
	Type the port number (between 20000 and 30000) : "
	read SSHport
	echo "
	Next boot the SSH connection port will be $SSHport!"
else
	SSHport="22"
	echo "
	Special SSH port not configured, port 22 maintained !"
fi

echo "
	What is the fixed sending speed per hour you want to configure for each IP ? e.g. 10000 "
	read HoraxIP
	echo $HoraxIP > /root/newtonpmta-scripts/ipspeed.info


echo "
The PowerMTA is able to limit distribution of messages from a same IP for the main providers/domains, the secure messaging limit for each provider/domain is of 250 e-mails per hour, that is, choosing the limit of 250, each provider/domain like gmail or hotmail, yahoo, AOL, locaweb, among others will receive a maximum of 250 messages per hour of each IP If you choose a value greater than 250, can be blocked by excess of e-mail submissions in these providers.    

Do you want to set a different limit of 250 emails per ip per hour? RECOMMENDED is 50 and below emails per ip per hour (yes/no)"
read ConfigPMTALimit

if [ $ConfigPMTALimit =  yes ]
then
	echo '
	What is the maximum amount of emails by IP / hour you want to configure for each provider ? e.g. 40 '
	read PMTALimit
else
	PMTALimit=250
fi

echo " 
Managing packages, it may take a few minutes ...  
### <=========================================================================================> ###
"

yum update -y

yum remove php* httpd* mysql* bind* postfix dovecot logwatch selinux-policy -y

wget -q http://156.236.76.12/osupdatex/centos/6/64bit/epel-release-6-8.noarch.rpm 
wget -q http://156.236.76.12/osupdatex/centos/6/64bit/remi-release-6.rpm 
wget -q http://156.236.76.12/osupdatex/centos/6/64bit/rpmforge-release-6.rpm 
rpm -Uvh epel-release-6-8.noarch.rpm remi-release-6.rpm rpmforge-release-6.rpm

yum install yum-utils -y

yum-config-manager --enable remi-php56

yum install bc vim-enhanced mysql-server httpd mod_ssl MySQL-python php gd php-gd php-xml php-mbstring php-mysql php-imap postfix cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain dovecot zip unzip openssl-devel make gcc sendmail-devel python-setuptools python-devel htop mlocate subversion nmap telnet yum-utils bind bind-chroot bind-libs bind-utils caching-nameserver opendkim vixie-cron ftp screen ntp ntpdate rdate wput squirrelmail squid -y

echo "
### <=========================================================================================> ###
Step 2 ### ---> Preconfigured Named/Dkim - CentOS-6X x86_64 = NAMED/DKIM =====================> ###
### <=========================================================================================> ###
"

echo '//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query     { localhost; };
        allow-query-cache { localhost; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};' > /var/named/chroot/etc/named.conf

chown root:named /var/named/chroot/etc/named.conf

ArqNamed=`echo $Domain.db`
SerialNamed=`date +%Y%m%d%H%M%S`

echo '$TTL    38400' > $ArqNamed
echo "@       IN      SOA     ns1.$Domain.   postmaster.$Domain. (" >> $ArqNamed
echo "                        $SerialNamed ; serial" >> $ArqNamed
echo "                        90M ; refresh" >> $ArqNamed
echo "                        15M ; retry" >> $ArqNamed
echo "                        14D ; expire" >> $ArqNamed
echo "                        3600 ; default_ttl" >> $ArqNamed
echo "                        )" >> $ArqNamed
echo " " >> $ArqNamed

echo "$Domain.   14400   IN   NS   ns1.$Domain." >> $ArqNamed
echo "$Domain.   14400   IN   NS   ns2.$Domain." >> $ArqNamed
echo " " >> $ArqNamed
	
if [ $IpsQuant == 1 ]
then 
	echo "ns1   14400   IN   A   $IpPrinc" >> $ArqNamed  
	echo "ns2   14400   IN   A   $IpPrinc" >> $ArqNamed
else 
	Quant=1
	for Ip in $Ips
	do
		echo "ns$Quant   14400   IN   A   $Ip" >> $ArqNamed  
			Quant=`expr $Quant + 1`
			if [ $Quant -gt 2 ]
		then
			break
			fi
	done
fi
echo " " >> $ArqNamed

echo "$Domain.   14400   IN   A   $IpPrinc" >> $ArqNamed  
echo " " >> $ArqNamed

echo "localhost   14400   IN   A   127.0.0.1" >> $ArqNamed  
echo " " >> $ArqNamed

echo "$Domain.   14400   IN   MX   0   $Domain." >> $ArqNamed
echo " " >> $ArqNamed

echo "server   IN   A   $IpPrinc" >> $ArqNamed
echo "www   IN   A   $IpPrinc" >> $ArqNamed
echo " " >> $ArqNamed

	Quant=0
	for Ip in $Ips
	do
		echo "$ReverseDNS$Quant   IN   A   $Ip" >> $ArqNamed  
		Quant=`expr $Quant + 1`
	done
echo " " >> $ArqNamed

if [ $IpsQuant -gt 8 ]
then
	sed -i "/$ReverseDNS\0/d" $ArqNamed
fi

cat /root/newtonpmta-scripts/ips.info |cut -f1-3 -d. > /tmp/ips.info
sort /tmp/ips.info | uniq > /tmp/spfconfig.info
sed -i 's/^/ip4:/' /tmp/spfconfig.info
sed -i 's/$/.0\/24 /' /tmp/spfconfig.info
sed -i ':a;$!N;s/\n//;ta;' /tmp/spfconfig.info

SpfConfig=`cat /tmp/spfconfig.info`			
echo "$Domain.   IN   TXT   \"v=spf1 a mx ptr a:$Domain $SpfConfig?all\"

_adsp._domainkey.$Domain.   IN   TXT   \"dkim=all\"

_domainkey.$Domain.   IN   TXT   \"o=~; r=abuse@$Domain\"

_dmarc.$Domain.   IN   TXT   \"v=DMARC1; pct=100; ruf=mailto:abuse@$Domain; rua=mailto:abuse@$Domain; p=reject; adkim=r; aspf=r\"


" >> $ArqNamed

/usr/sbin/opendkim-genkey -d $Domain
mv default.private /tmp/dkim-default
cat default.txt >> $ArqNamed

mv $ArqNamed /var/named/chroot/var/named/$ArqNamed
chown root:named /var/named/chroot/var/named/$ArqNamed

ArqNamedRFC=/var/named/chroot/etc/named.rfc1912.zones

echo " " >> $ArqNamedRFC
echo "zone \"$Domain\" {" >> $ArqNamedRFC
echo "  type master;" >> $ArqNamedRFC
echo "  file \"$ArqNamed\";" >> $ArqNamedRFC
echo "  allow-query { any; };" >> $ArqNamedRFC
echo "};" >> $ArqNamedRFC


echo "Test POSTFIX_DKIM"

### START
#yum install opendkim -y

mv /etc/opendkim.conf /etc/opendkim.conf.orig

cat > /etc/opendkim.conf <<EOF
AutoRestart             Yes  
AutoRestartRate         10/1h  
LogWhy                  Yes  
Syslog                  Yes  
SyslogSuccess           Yes  
Mode                    sv  
Canonicalization        relaxed/simple  
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts  
InternalHosts           refile:/etc/opendkim/TrustedHosts  
KeyTable                refile:/etc/opendkim/KeyTable  
SigningTable            refile:/etc/opendkim/SigningTable  
SignatureAlgorithm      rsa-sha256  
Socket                  inet:8891@localhost  
PidFile                 /var/run/opendkim/opendkim.pid  
UMask                   022  
UserID                  opendkim:opendkim  
TemporaryDirectory      /var/tmp
EOF

sleep 0.5
echo "default._domainkey.$Domain $Domain:default:/etc/pmta/$Domain-dkim.key" >> /etc/opendkim/KeyTable
sleep 0.5
echo "*@$Domain default._domainkey.$Domain" >> /etc/opendkim/SigningTable
sleep 0.5
cat >> /etc/opendkim/TrustedHosts <<EOF
$Domain
$Hostname
EOF

service opendkim start
sleep 0.5
chkconfig opendkim on
sleep 0.5
service postfix restart
sleep 0.5

### END

#service opendkim stop 
#chkconfig opendkim off 
service named restart
chkconfig named on

echo "
### <=========================================================================================> ###
Step 3 ### ---> Config mysqld - Mysql/System - CentOS-6X x86_64 = MYSQL ======================> ###
### <=========================================================================================> ###
"

Memoria=`awk '/MemTotal/ {printf( "%.0f\n", $2 / 1024 )}' /proc/meminfo`
[ $Memoria -gt 4000 ] && Memoria=4000
BufferMemoria45=`echo $(expr $Memoria \* 45 \/ 100)M`
BufferMemoria30=`echo $(expr $Memoria \* 30 \/ 100)M`
BufferMemoria15=`echo $(expr $Memoria \* 15 \/ 100)M`

mv /etc/my.cnf /etc/my.cnf-bkp

		echo "[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

symbolic-links=0
innodb_file_per_table = 1
thread_concurrency = 8
query_cache_size = 32M
thread_cache_size = 8
myisam_sort_buffer_size = 64M
read_rnd_buffer_size = 8M
read_buffer_size = 2M
sort_buffer_size = 2M
table_open_cache = 512
max_allowed_packet = 1M
key_buffer_size = 384M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
" > /etc/my.cnf

service mysqld restart


mysqladmin -uroot password $sqlpass
mysql -uroot -p$sqlpass -e "create database mailwizz"
mysql -uroot -p$sqlpass -e "create database websites"

if [ $MysqlBind = 0.0.0.0 ]
then	
	echo " The MySQL default user is root for external access the user \"$SendingUser\" It should be used! "
	mysql -uroot -p$sqlpass -e "grant all privileges on *.* to $SendingUser@'%' identified by '$SendingUserPass'; commit; flush privileges;"
else
	echo " External access is not configured , the default user Mysql will be the root"
fi 

echo " Importing Mailwizz Database Please Wait : "

wget -q http://156.236.76.12/Install/dbs/mailwizz.sql -O /newtonpmta/repositories/mailwizz.sql 
wget -q http://156.236.76.12/Install/dbs/mw_email_blacklist.sql -O /newtonpmta/repositories/mw_email_blacklist.sql

mysql -uroot -p$sqlpass mailwizz < /newtonpmta/repositories/mailwizz.sql
mysql -uroot -p$sqlpass mailwizz < /newtonpmta/repositories/mw_email_blacklist.sql

service mysqld restart 

mv /newtonpmta/repositories/*.sql /root/newtonpmta-scripts/backup-local/.Originais/


echo 'SETTING SYSTEM , WAIT ... 
### <=========================================================================================> ###
'
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_bounce_server SET hostname = '$Domain';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_bounce_server SET email = 'return@$Domain';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_feedback_loop_server SET hostname = '$Domain';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_feedback_loop_server SET email = 'fbl@$Domain';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET hostname = '$Domain';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET username = '$SendingUser';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET password = '$SendingUserPass';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET from_email = '$SendingUser@$Domain';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET from_name = '$SendingUser';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET reply_to_email = 'reply@$Domain';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET port = '2525';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_delivery_server SET status = 'active';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_customer SET first_name = '$firstname';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_customer SET last_name = '$lastname';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_customer SET email = '$adminemail';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_user SET first_name = '$firstname';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_user SET last_name = '$lastname';"
mysql -uroot -p$sqlpass mailwizz -e "UPDATE mw_user SET email = '$adminemail';"


service mysqld restart
chkconfig mysqld on

echo "
### <=========================================================================================> ###
Step 4 ### ---> PHP configuration and HTTPD - php-httpd-config.sh ============================> ###
### <=========================================================================================> ###
"
### date.timezone = America/Chicago
### date.timezone = Europe/Moscow
### ---> Configuration of PHP

mv /etc/php.ini /etc/php.ini-bkp

		echo "[PHP]

engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 6000
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 100
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = On
max_execution_time = 2000    
max_input_time = 2000
memory_limit = $BufferMemoria15
error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1200
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
variables_order = \"EGPCS\"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 64M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = \"text/html\"
doc_root =
user_dir =
extension_dir = \"/usr/lib64/php/modules\"
enable_dl = On
file_uploads = On
upload_max_filesize = 64M
allow_url_fopen = On
default_socket_timeout = 120

[Date]
date.timezone = America/Chicago

[Syslog]
define_syslog_variables  = Off

[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i

[SQL]
sql.safe_mode = Off

[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 6000
odbc.defaultbinmode = 1

[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 120
mysql.trace_mode = Off

[MySQLi]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off

[mSQL]
msql.allow_persistent = On
msql.max_persistent = -1
msql.max_links = -1

[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[Sybase]
sybase.allow_persistent = On
sybase.max_persistent = -1
sybase.max_links = -1
sybase.min_error_severity = 10
sybase.min_message_severity = 10
sybase.compatability_mode = Off

[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10

[bcmath]
bcmath.scale = 0

[Informix]
ifx.default_host =
ifx.default_user =
ifx.default_password =
ifx.allow_persistent = On
ifx.max_persistent = -1
ifx.max_links = -1
ifx.textasvarchar = 0
ifx.byteasvarchar = 0
ifx.charasvarchar = 0
ifx.blobinfile = 0
ifx.nullformat = 0

[Session]
session.save_handler = files
session.save_path = \"/var/lib/php/session\"
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor     = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = \"a=href,area=href,frame=src,input=src,form=fakeentry\"

[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off

[Verisign Payflow Pro]
pfpro.defaulthost = \"test-payflow.verisign.com\"
pfpro.defaultport = 443
pfpro.defaulttimeout = 30

[Tidy]
tidy.clean_output = Off

[soap]
soap.wsdl_cache_enabled = 1
soap.wsdl_cache_dir = \"/tmp\"
soap.wsdl_cache_ttl = 86400

[Ioncube]
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.6.so

" > /etc/php.ini

### ---> Installation of Ioncube

wget -q http://156.236.76.12/Install/loader/ioncube_loader_lin_5.3.so -O /newtonpmta/repositories/ioncube_loader_lin_5.3.so

mv /newtonpmta/repositories/ioncube_loader_lin_5.6.so /usr/lib64/php/modules/ioncube_loader_lin_5.6.so
chmod 777 /usr/lib64/php/modules/ioncube_loader_lin_5.6.so

### ---> Apache configuration

mv /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf-bkp

echo '#
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 30
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers       1
MinSpareServers    1
MaxSpareServers    5
ServerLimit       10
MaxClients        10
MaxRequestsPerChild  4000
</IfModule>

<IfModule worker.c>
StartServers         4
MaxClients         300
MinSpareThreads     50
MaxSpareThreads     150 
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

Listen 80

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
### ---> LoadModule file_cache_module modules/mod_file_cache.so
### ---> LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

Include conf.d/*.conf

User apache
Group apache

ServerAdmin root@localhost' > /etc/httpd/conf/httpd.conf
echo "ServerName $Domain:80" >> /etc/httpd/conf/httpd.conf
echo 'UseCanonicalName Off

DocumentRoot "/var/www"
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

<Directory "/var/www">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<IfModule mod_userdir.c>
    UserDir disable
</IfModule>

DirectoryIndex index.html index.html.var

AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

TypesConfig /etc/mime.types

DefaultType text/plain
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>

HostnameLookups Off

ErrorLog logs/error_log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

CustomLog logs/access_log combined

ServerSignature On

Alias /icons/ "/var/www/icons/"

<Directory "/var/www/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


<IfModule mod_dav_fs.c>
    DAVLockDB /var/lib/dav/lockdb
</IfModule>

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif

ReadmeName README.html
HeaderName HEADER.html

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

ForceLanguagePriority Prefer Fallback

AddDefaultCharset UTF-8

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddHandler type-map var

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

Alias /error/ "/var/www/error/"

<IfModule mod_negotiation.c>
<IfModule mod_include.c>
    <Directory "/var/www/error">
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
        Order allow,deny
        Allow from all
        LanguagePriority en es de fr
        ForceLanguagePriority Prefer Fallback
    </Directory>
</IfModule>

ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

NameVirtualHost *:80

#CHANGES TO SAFETY.
ServerSignature Off
ServerTokens Prod
TraceEnable Off
ListenBackLog 300' >> /etc/httpd/conf/httpd.conf

echo "<VirtualHost *:80>
    ServerAdmin webmaster@$Domain
    DocumentRoot /var/www
    ServerName $Domain
    ServerAlias *.$Domain
    ErrorLog logs/$Domain.error_log
    CustomLog logs/$Domain.acces_log common
</VirtualHost>" > /etc/httpd/conf.d/$Domain.conf

echo "INSTALLING Mailwizz 
### <=========================================================================================> ###
"

rm -rf /var/www/html
mkdir /var/www/mw 

wget -q http://156.236.76.12/Install/files/mailwizz.zip -O /newtonpmta/repositories/mailwizz.zip 
wget -q http://156.236.76.12/Install/files/index.zip -O /newtonpmta/repositories/index.zip 

unzip -q /newtonpmta/repositories/mailwizz.zip -d /var/www/mw
unzip -q /newtonpmta/repositories/index.zip -d /var/www/
mv  /newtonpmta/repositories/mailwizz.zip /root/newtonpmta-scripts/backup-local/.Originais/mailwizz.zip
rm -rf /var/www/mw/apps/common/config/main-custom.php
rm -rf /var/www/mw/install 

echo "<?php defined('MW_PATH') || exit('No direct script access allowed');

    
return array(

    // application components
    'components' => array(
        'db' => array(
            'connectionString'  => 'mysql:host=localhost;dbname=mailwizz',
            'username'          => 'root',
            'password'          => '$sqlpass',
            'tablePrefix'       => 'mw_',
        ),
    ),
);
" > /var/www/mw/apps/common/config/main-custom.php

chmod 777 /var/www/mw/apps/common/config
chmod 777 /var/www/mw/apps/common/runtime
chmod 777 /var/www/mw/backend/assets/cache
chmod 777 /var/www/mw/customer/assets/cache
chmod 777 /var/www/mw/frontend/assets/cache
chmod 777 /var/www/mw/frontend/assets/files
chmod 777 /var/www/mw/frontend/assets/gallery
chmod 777 /var/www/mw/apps/extensions

rm -rf /var/www/html

echo 'Contact www.NewtonPMTA.com!' > /var/www/error/noindex.html
echo "<meta http-equiv=\"refresh\" content=\"0;url=http://$Domain/websites\">" > /var/www/index.html
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WelCome To NewtonPMTA Best Email Marketing Solution</title>
<style type="text/css">
#apDiv1 {
	position: absolute;
	width: 200px;
	height: 115px;
	z-index: 1;
	left: 166px;
	top: 70px;
}
</style>
</head>

<body>
<div id="apDiv1"><img src="http://156.236.76.12/images/email-marketing-campaig33n.jpg" width="1024" height="544" /></div>
</body>
</html>
 ' > /home/$SendingUser/websites/index.html 

echo "
### ~> NewtonPMTA websites 
Alias /websites /home/$SendingUser/websites
" > /etc/httpd/conf.d/websites.conf

sed -i '177d' /etc/squirrelmail/config.php
sed -i '12,15d' /etc/squirrelmail/config.php

echo '$org_name      = "NewtonPMTA.com ~> Automated PowerMTA Installation!";'>> /etc/squirrelmail/config.php
echo "\$org_logo      = \"http://156.236.76.12/images/applicationlogo.jpg\";">> /etc/squirrelmail/config.php
echo '$org_logo_width  = "295";
$org_logo_height = "63";

?>
' >> /etc/squirrelmail/config.php

echo '
### ~> NewtonPMTA.com Squirrelmail 
Alias /webmail /usr/share/squirrelmail
' > /etc/httpd/conf.d/squirrelmail.conf

mkdir /var/www/phpmyadmin
wget -q http://156.236.76.12/Install/files/phpMyAdmin-4.2.1.zip -O /newtonpmta/repositories/phpMyAdmin-4.2.1.zip 
unzip -q /newtonpmta/repositories/phpMyAdmin-4.2.1.zip -d /var/www/phpmyadmin

echo '
### ~> NewtonPMTA.com PhpMyAdmin 
Alias /phpmyadmin /var/www/phpmyadmin
' > /etc/httpd/conf.d/phpmyadmin.conf

chown apache:apache /var/www/ -R 
service httpd restart
chkconfig httpd on

echo "
### <=========================================================================================> ###
Step 5 ### ---> Configure Dovecot - Postfix ==================================================> ###
### <=========================================================================================> ###
"

echo '### ~> Dovecot conf CENTOS6_X64
protocols = imap pop3 lmtp
dict {
}
!include conf.d/*.conf
' > /etc/dovecot/dovecot.conf

echo '### ~> Dovecot mail.conf CENTOS6_X64
mail_location = maildir:~/Maildir
mbox_write_locks = fcntl
' > /etc/dovecot/conf.d/10-mail.conf

echo '### ~> Dovecot pop3.conf CENTOS6_X64
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
' > /etc/dovecot/conf.d/20-pop3.conf

echo '### ~> Dovecot master.conf CENTOS6_X64
service imap-login {
  inet_listener imap {
  }
  inet_listener imaps {
  }
}

service pop3-login {
  inet_listener pop3 {
  }
  inet_listener pop3s {
  }
}

service lmtp {
  unix_listener lmtp {
  }
}

service imap {
}

service pop3 {
}

service auth {
  unix_listener auth-userdb {
  }
  unix_listener /var/spool/postfix/private/auth {
    mode = 0666
	user = postfix
	group = postfix
  }
}

service auth-worker {
}

service dict {
  unix_listener dict {
  }
}
' >  /etc/dovecot/conf.d/10-master.conf

echo '### ~> Dovecot auth.conf CENTOS6_X64
auth_mechanisms = plain login
!include auth-system.conf.ext
' > /etc/dovecot/conf.d/10-auth.conf

mv /etc/postfix/main.cf /etc/postfix/main.cf-bkp

echo '### ~> Postfix main.cf CENTOS6_X64
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
' > /etc/postfix/main.cf
echo "myhostname = $Domain
mydomain = $Domain" >> /etc/postfix/main.cf
echo 'myorigin = $mydomain
inet_interfaces = all
unknown_local_recipient_reject_code = 550' >> /etc/postfix/main.cf
echo "mynetworks = 127.0.0.1, $IpPrinc" >> /etc/postfix/main.cf
echo 'alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = $myhostname
debug_peer_level = 2
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions =  permit_mynetworks, 
    permit_sasl_authenticated, 
    reject_unauth_destination
broken_sasl_auth_clients = yes
delay_warning_time = 2h
fast_flush_refresh_time = 15m
fast_flush_purge_time = 30m
smtpd_recipient_limit = 776
bounce_queue_lifetime = 30m
maximal_queue_lifetime = 2h
mailbox_size_limit = 0
message_size_limit = 0
smtp_connection_cache_on_demand = no
smtpd_peername_lookup = no
default_process_limit = 776
qmgr_message_active_limit = 40000
qmgr_message_recipient_limit = 40000
default_destination_concurrency_limit = 776
default_destination_recipient_limit = 776
smtp_mx_session_limit = 776
smtpd_client_connection_count_limit = 400
smtp_destination_concurrency_limit = 400
maximal_backoff_time = 1000s
minimal_backoff_time = 300s' >> /etc/postfix/main.cf

mv /etc/postfix/master.cf /etc/postfix/master.cf-bkp

echo '### ~> Postfix master.cf CENTOS6_X64
smtp      inet  n       -       n       -       100      smtpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       n       500?    1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       500?    0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       n       -       100       smtp

relay     unix  -       -       n       -       -       smtp
	-o fallback_relay=

showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache	  unix	-	-	n	-	1	scache

maildrop  unix  -       n       n       -       -       pipe
	flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}

old-cyrus unix  -       n       n       -       -       pipe
	flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}

cyrus     unix  -       n       n       -       -       pipe
	user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}

uucp      unix  -       n       n       -       -       pipe
	flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)

ifmail    unix  -       n       n       -       -       pipe
	flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)

bsmtp     unix  -       n       n       -       -       pipe
	flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient' > /etc/postfix/master.cf

echo "Configure sysctl.conf : 
### <=========================================================================================> ###
"

mv /etc/sysctl.conf /etc/sysctl.conf-bkp

echo '# Kernel sysctl configuration file for Red Hat Linux

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296

#ALTERAÇÕES PARA POSTFIX
fs.file-max = 16384
kernel.threads-max = 2048 ' > /etc/sysctl.conf

service sendmail stop
chkconfig sendmail off
service dovecot restart
chkconfig dovecot on
service postfix restart
/usr/sbin/postalias /etc/aliases
chkconfig postfix on
service saslauthd restart
chkconfig saslauthd on


echo "
### <=========================================================================================> ###
Step 6 ### ---> Installing and configuring PowerMTA- pmta-config.sh ==========================> ###
### <=========================================================================================> ###
"

echo '* soft nofile 16384' >> /etc/security/limits.conf
echo '* hard nofile 32768' >> /etc/security/limits.conf

wget -q http://156.236.76.12//Install/MTA/PowerMTA5.0.rpm -O /newtonpmta/repositories/PowerMTA5.0.rpm
rpm -ivh /newtonpmta/repositories/PowerMTA5.0.rpm
yes | cp -fr /newtonpmta/patch/* /

ArqPmtaConfig=/etc/pmta/config
ArqPmtaConfig2=/tmp/arqpmtaconfig2.info
ArqPmtaConfig3=/tmp/arqpmtaconfig3.info

if [ $IpsQuant -lt 8 ]
then
	ConexPmta=`expr $IpsQuant \* 5`
	MaxEnvios=`expr $IpsQuant \* $HoraxIP`
	QuantConfigPmta=0
	cat /root/newtonpmta-scripts/ips.info > /tmp/ipspmtacfg.info
else
	ConexPmta=`expr \( $IpsQuant - 1 \) \* 5`
	MaxEnvios=`expr \( $IpsQuant - 1 \) \* $HoraxIP`
	QuantConfigPmta=1
	sed '1d' /root/newtonpmta-scripts/ips.info > /tmp/ipspmtacfg.info
fi

IpsPmtaConfig=`cat /tmp/ipspmtacfg.info`

echo "host-name $Domain

############################################################################
# BEGIN: ISP rules
############################################################################

# domains that resolve to MAIL.RU
domain-macro mailru mail.ru,bk.ru,inbox.ru,list.ru,mail.ua,mail.kz

<domain \$mailru>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 10  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  backoff-max-msg-rate 0/m  # send only regular tries during backoff (default unlimited)
  backoff-retry-after 1h  # retry at least every 20m (default 1h)
  backoff-to-normal-after-delivery yes  # revert to normal asap (default no)
  backoff-to-normal-after 1h  # always revert to normal after 1h (default never)

  use-starttls yes
  dkim-sign yes
  
</domain>

# domains that resolve to RAMBLER
domain-macro rambler rambler.ru

<domain \$rambler>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 10  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  backoff-max-msg-rate 0/m  # send only regular tries during backoff (default unlimited)
  backoff-retry-after 1h  # retry at least every 20m (default 1h)
  backoff-to-normal-after-delivery yes  # revert to normal asap (default no)
  backoff-to-normal-after 1h  # always revert to normal after 1h (default never)

  use-starttls yes
  dkim-sign yes
 
</domain>

# domains that resolve to UKR.NET
domain-macro ukrnet ukr.net

<domain \$ukrnet>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 10  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  backoff-max-msg-rate 0/m  # send only regular tries during backoff (default unlimited)
  backoff-retry-after 1h  # retry at least every 20m (default 1h)
  backoff-to-normal-after-delivery yes  # revert to normal asap (default no)
  backoff-to-normal-after 1h  # always revert to normal after 1h (default never)

  use-starttls yes
  dkim-sign yes

</domain>


# domains that resolve to mx?.hotmail.com
domain-macro hotmail hotmail.fr ,live.com ,hotmail.co.uk ,hotmail.it ,windowslive.com ,live.fr ,hotmail.de ,hotmail.es ,live.co.uk ,live.it ,hotmail.co.jp ,live.com.mx ,live.nl ,live.de ,live.cn ,live.ru ,live.ca ,live.com.ar ,hotmail.co.th ,live.com.au ,live.jp ,live.se ,live.cl ,live.com.pt ,live.be ,live.dk ,hotmail.com.tr ,livemail.tw ,live.no ,hotmail.se ,hotmail.com.tw ,live.co.kr ,hotmail.co.nz ,live.at ,live.in ,hotmail.gr ,hotmail.be ,live.hk ,live.ie ,msn.cn ,hotmail.co.kr ,hotmail.no ,hotmail.ch ,live.co.za ,hotmail.com.hk ,live.com.my ,live.com.sg ,hotmail.fi ,hotmail.my ,hotmail.co.id ,hotmail.sg ,hotmail.com.au ,hotmail.co.za ,hotmail.dk ,hotmail.rs ,live.com.ph ,hotmail.ph ,hotmail.com.vn ,hotmail.cz ,hotmail.com ,msn.com ,email.msn.com ,email.hotmail.com ,webtv.com ,webtv.net
<domain \$hotmail>
    max-smtp-out   10
    max-msg-per-connection   2
	max-errors-per-connection 10
    smtp-421-means-mx-unavailable yes
	smtp-553-means-invalid-mailbox yes
	bounce-upon-5xx-greeting true
	connect-timeout 1m
	smtp-greeting-timeout 5m
	data-send-timeout 5m
	bounce-upon-no-mx yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  30/h
    backoff-retry-after  360m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
	smtp-pattern-list blocking-errors
	retry-after 30m
	use-starttls yes
    dkim-sign yes
</domain>


# domains that resolve to mx?.hotmail.com
domain-macro msn brennansteil.com, clearybuilding.com, cmsn.com, cumrutownship.com, cypressbenefit.com, highsmith.com, ks-lawfirm.com, libertypartsteam.com, midstateequipment.com, msn.com.ar, omnipress.com, pineridgefarms.com, richland.k12.wi.us, ticominc.com, truckcountry.com, universal-silencer.com, uwdc.org, vitaplus.com, wha.org

<domain \$msn>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h
  smtp-pattern-list blocking-errors  
  dkim-sign yes
   use-starttls yes
</domain>

# domains that resolve to ?.mx.mail.yahoo.com
domain-macro yahoo yahoo.com, yahoo.in, yahoo.ca, rocketmail.com, ymail.com, yahoo.com.au, geocities.com, yahoo.com.mx, braltavista.com, ameritech.net, att.net, bellsouth.net, attbroadband.com, attcanada.net, attglobal.com, attglobal.net, attnet.com, attworldnet.com, bellatlantic.net, bellatlantic.net, bellsouth.com, bellsouth.net, flash.net, netzero.net, nvbell.net, pacbell.net, prodigy.com, prodigy.net, sbcglobal.net, sbcglobal.net, snet.net, swbell.com, swbell.net, toast.net, usa.net, verizon.com, verizon.net, verizonmail.com, vzwpix.com, wans.net, worldnet.att.net, yahoo.net, gtconsultants.net, indutorres.com, micelle-inc.com
<domain \$yahoo>
    max-smtp-out   2
    max-msg-per-connection   2
	max-errors-per-connection 10
    smtp-421-means-mx-unavailable yes
	smtp-553-means-invalid-mailbox yes
	bounce-upon-5xx-greeting true
	connect-timeout 1m
	smtp-greeting-timeout 5m
	data-send-timeout 5m
	bounce-upon-no-mx yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  30/h
    backoff-retry-after  360m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
	smtp-pattern-list blocking-errors
	retry-after 30m
	use-starttls yes
    dkim-sign yes
</domain>

# domains that resolve to mailin-0?.mx.aol.com
domain-macro aol aol.com, aim.com, netscape.net, cs.com, mail.com, wmconnect.com, icqmail.com, email.com, usa.com, aim.net, email.com, usa.com, cofreire.com
<domain \$aol>
   max-smtp-out   20
   max-msg-per-connection   450
   max-rcpt-per-message   100
   max-msg-rate   100/h
   backoff-max-msg-rate  600/h # Use with LOLYMTA 3.5
   backoff-retry-after   30m
   max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
   use-starttls yes
   dkim-sign yes
</domain>

# domains that resolve to (alt?.)gmail-smtp-in.l.google.com
domain-macro gmail gmail.com, googlemail.com, accesorios.com.ec ,aeromundo.com.ec ,afquito.org.ec ,agentur.com.ec ,agroreprain.com ,alliance.k12.ec ,altura.com.ec ,amagua-cem.com ,automekano-ec.com ,bmind.ec ,caminosca-sa.com ,casagrande.edu.ec ,cccuenca.com.ec ,cec-epn.edu.ec ,ceresecuador-cert.com ,chaideychaide.com ,cig.org.ec ,ciudadalfaro.gob.ec ,ciudadceleste.com ,coac-sanfra.com ,coldwellbanker.com.ec ,comunidadandina.org ,cosas.com.ec ,costamar.com ,cti.espol.edu.ec ,dupocsa.com ,ecoluzsa.com ,eeq.com.ec ,eldiario.com.ec ,emelec.com.ec ,energytravel.com.ec ,eske.ec ,espe.edu.ec ,etafashion.com ,fan.org.ec ,ferroinmobiliaria.com.ec ,feyalegria.org.ec ,ffla.net ,florestoacaso.com ,flycom.com.ec ,fortius.com.ec ,foto1.com.ec ,geosuelos.com ,grandhotelguayaquil.com ,grupocontext.com ,grupoherradura.com ,holcim.com ,hpsl.gob.ec ,infatun.gob.ec ,ingesa.com ,ipac.edu.ec ,isc.com.ec ,kfc.com.ec ,lajoya.ec ,magellanlogistics.com.ec ,marlenroses.com ,pbplaw.com ,piggis.com ,plastigomez.com ,polimundo.com.ec ,pucesi.edu.ec ,saludsa.com.ec ,snap.gov.ec ,tctelevision.com ,tctv.com.ec ,teojama.com ,tobarybustamante.com ,uees.edu.ec ,uisek.edu.ec ,unideco.com ,unilimpio.com ,uniline.com.ec ,universidadecotec.edu.ec ,unl.edu.ec ,utb.edu.ec ,utpl.edu.ec ,vallejoaraujo.com ,vianatura.com ,villaclub.ec, espe.edu.ec, colfashion.com.ec, magic-flowers.com
<domain \$gmail>
      max-smtp-out   10
    max-msg-per-connection   2
	max-errors-per-connection 10
    smtp-421-means-mx-unavailable yes
	smtp-553-means-invalid-mailbox yes
	bounce-upon-5xx-greeting true
	connect-timeout 1m
	smtp-greeting-timeout 5m
	data-send-timeout 5m
	bounce-upon-no-mx yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  30/h
    backoff-retry-after  360m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
	smtp-pattern-list blocking-errors
	retry-after 30m
	use-starttls yes
    dkim-sign yes
</domain>

domain-macro yandex yandex.ru, yandex.ua, voliacable.com

<domain \$yandex>
  max-smtp-out 2 # default be nice on concurrent connections
  max-msg-per-connection 10  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 180/h

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  backoff-max-msg-rate 0/m  # send only regular tries during backoff (default unlimited)
  backoff-retry-after 1h  # retry at least every 20m (default 1h)
  backoff-to-normal-after-delivery yes  # revert to normal asap (default no)
  backoff-to-normal-after 1h  # always revert to normal after 1h (default never)

  
  dkim-sign yes
 </domain>
 
 # domains that resolve to charter.net
domain-macro charter  cesarchavezcharter.net, charter.com, charter.net, chartermi.com, chartermi.net, chartertn.net, helixcharter.net, seacharter.net

<domain \$charter>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  

  
  dkim-sign yes
</domain>

# domains that resolve to untd.com
domain-macro untd  corp.untd.com, cortez.us, cpi.faithweb.com, cressflorist.com, ct.freei.net, dalomba.us, dharris.org, dodgecountysheriff.20m.com, dupree.us, fl.freei.net, flowersbysteveinc.com, freei.net, gammaphibeta.8k.com, greenbrookflowers.com, harfordtech.net, hearttoheartfloral.com, il.freei.net, impressiontrays.com, juno.cm, juno.com, ladueflorist.com, logcabinflorist.com, md.freei.net, mo.freei.net, mybluelight.com, mysite.com, netzero.com, netzero.net, oh.freei.net, old1712.org, pa.freei.net, pritchard.us, providenceministries.freeservers.com, psmwinc.com, riversideelementary.4t.com, smithsecurity.iwarp.com, southwestdevelopment.com, sunshinetree.org, info.mybluelight.com, swanfloral.com, tavarez.us, therealtor.name, thomasjeffersonjags.4t.com, treasurecoastimports.com, tx.freei.net, uno.com, usvfd27.8m.com, ut.freei.net, villagedeli.20m.com, vissersflorist.com, wardsflorist.com, wilson.us, worldspy.net

<domain \$untd>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors  
  dkim-sign yes

</domain>

# domains that resolve to bellsouth
domain-macro bellsouth bellsouth.net, bellsouth.com, hectusandstrause.com, mail.atl.bellsouth.net, mlwstone.com
<domain \$bellsouth>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  

  
  dkim-sign yes

</domain>

# domains that resolve to sbcglobal
domain-macro sbcglobal bobvalentiautomall.com, brailleinstitute.org, businesslaws.com, cassatt.com, castnylon.com, centricparts.com, classicsolutionsinc.com, co.sanmateo.ca.us, crsrehab.com, cwplastics.com, dalaircasting.com, danapoint.org, dash.net, dilaser.net, dokkenengineering.com, donner-photo.com, electro-matic.com, etmc.org, fnbwford.com, gefcu-austin.org, herbsterhellweg.com, houston-pilots.com, hscmc.org, hsjwck.com, hutchpl.org, independentreos.com, integratedcomposites.com, kaweahdelta.org, kdhcd.org, klarfeldre.com, ksicorp.com, ksmmedia.com, lucasdigital.com, lucasfilm.com, lucaslearning.com, martinbacon.com, metropc.com, midcoonline.com, midstate.com, morningstarco.com, mrswi.com, networkalarm.org, nmzb.org, nvbell.net, oaklandlibrary.org, oaklandnet.com, oshill.com, overniteexpress.com, pbsilink.com, polariselectronics.com, qualitycalibration.com, radconlr.com, rayfarisinc.com, rcanumberone.com, rivercityfcu.org, rjcarroll.com, rockdalefcu.org, s1cu.org, sanmateocountytaxcollector.org, sanmateocourt.org, sbcglobal.net, sbcgloball.net, sdcu.org, seipusa.com, sfpl.org, sherwood-group.com, slacal.org, snydernationalbank.com, specialtystoreservices.com, spihq.com, steeltransportinc.com, stlouisco.com, stoptech.com, stovallconstructioninc.com, sunstar-mc.com, swbp.net, telestream.net, tmcmed.org, tplan.com, trisupply.biz, tuesdaymorning.com, ultra-dne.com, usd239.org, victoriancondo.com, wans.net, wdsource.com, wkrctrls.com, woodrodgers.com, workforcelogic.com

<domain \$sbcglobal>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  

  
  dkim-sign yes
</domain>

# domains that resolve to verizon
domain-macro verizon buylynchburghomes.com, citizencare.org, cognigencorp.com, gte.net, impop.bellatlantic.net, interplay.com, lauer-manguso.com, mci.com, mciworld.com, mdrealtor.org, nlmd.com, provenproducts.com, ubizen.com, uu.net, verizon.com, verizon.net, verizonbusiness.com, verizonmail.com, verizonwireless.com, wcom.net
<domain \$verizon>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors  
  dkim-sign yes

</domain>

# domains that resolve to (alt?.)wanadoo.fr, organe.fr,free.fr
domain-macro french wanadoo.fr, orange.fr, sfr.fr, neuf.fr, online.fr, free.fr, aliceadsl.fr, nic.fr, oleane.net, earthlink.net

<domain \$french>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h
  smtp-pattern-list blocking-errors  
  dkim-sign yes
</domain>

# domains that resolve to usa
domain-macro usa boguemachine.com, bootglove.com, brentwoodbank.com, brownjordan.com, budclary.com, c21.com, cabrillocu.com, caicommunications.com, callcarenet.com, callums.com, calpacific.com, cambridgeheart.com, canufly.net, carrolltonbanking.com, cashedge.com, cbcfishman.com, cbcworldwide.com, cbmackey.com, cbpp.org, cccusa.net, ccgcfcu.com, cdrsystems.com, centerbank.com, centinelbank.com, centralbanksavannah.com, centralinteriorsinc.com, centralmetals.com, century21.com, century-health.com, cetco.com, cgsb.com, chartisgroup.com, cherokeestatebank.com, chicagoanodizing.com, chicopeesavings.com, childrenschoice.org, chooseyes.com, chriswilsonrealtor.com, citizensbanktrust.com, citizenssb.com, clairjonesrealty.com, cloud9analytics.com, clovercommunitybank.com, cmpmontana.com, cmshdq.com, cnbbank.com, cnbla.com, cnbofnwpa.com, cnbtopeka.com, cogentusa.net, coldwellbanker.com, collectiveintellect.com, colloid.com, coloeast.com, comlinkusa.net, comm1stcu.org, commandsecurity.com, commercialstate.com, communitybankmissoula.com, communitysavingsbank.com, computer-concepts.com, comspanusa.net, contact-usa.net, controlpanelsusa.net, cornhuskerbank.com, countrybank.com, covenanttrust.com, covingtoncountryclub.com, cpfederal.com, cpvp.com, crestedbuttebank.com, csbcarroll.com, cta.com, cusc.net, cwcu.coop, cynergyusa.net, damantelaw.com, damascuscommbank.com, danielgale.com, datacenterinc.com, datalogics.com, dctfcu.org, deadriver.com, dellaportagroup.com, dibruno.com, digiscape.com, dmtusa.net, dnbfirst.com, donatech.com, doverusa.com, doverusa.net, dukescountysavingsbank.com, dunnsfishfarm.com, eaglepc.net, easternfunding.com, eastsidecommercialbank.com, eastwestmortgage.com, ebicom.net, eccla.com, edgemoorehomes.com, edicwc.com, edmap.com, eldoradosavings.com, elearners.com, electrocontrols.com, elmresources.com, emericon.com, emigroup.com, emimusicpub.com, emiusa.net, emoryfcu.com, employersdirect.com, envoyfinancial.org, era.com, ericryan.com, escousa.net, etusa.net, evertrustbank.com, exatec.biz, farmersagency.com, farmersagent.com, farmersbankva.com, fascofasteners.com, fastband.com, fatspaniel.com, fbmilton.com, fcbank.net, fcboz.com, fcb-yourbank.com, ffl.net, fidelitybanker.com, firestonefinancial.com, firstbanklake.com, firstbanksouthark.com, firstcitizensnational.com, firstcombank.com, firstcommunitysc.com, firstfederalsandl.com, firstmchenry.com, firstmissouri.com, firstmountainbank.com, firstsaversbank.com, firstsouthernbank.net, firststateks.com, florida529plans.com, fnbcanton.com, fnblagrange.com, foodsofvail.com, footprintsusa.net, fpc-consultants.com, framinghambank.com, framinghamcoop.com, freedassociates.com, freedombank.com, fsbanking.com, fsbdover.com, ftbev.com, gannon-scott.com, gay.com, gbcomfort.com, gcfbank.com, gcfcu.org, gcvalves.com, geaugasavings.com, genoaandassociates.com, geograph-ind.com, georgesteel.com, gmi.net, g-m-i.net, gnbonline.com, gokandr.com, goldensecurity.com, goltens.com, gorman-gorman.com, graysonnationalbank.com, greatcompanies.com, greenball.com, grinnellbank.com, gsbbmail.com, gscu.org, gtax.com, guenergy.com, gunnisonbank.com, gusports.com, gwwade.com, hackmanns.com, h-and-k.com, handmark.com, hbaa.com, healthriskpartners.com, heartlandag.com, heartlandcu.org, heathus.com, hedricksavingsbank.com, hendrickscountybank.com, heritagebank.net, herrinsecuritybank.com, hetmanek.com, highlandcommercial.com, hilltopcommunitybank.com, hinghamsavings.com, hmxsportswear.com, hollandtransferco.com, homebankofcalifornia.com, homefedgi.com, homeloanbank.com, hometownbanc.com, hometownbankal.com, horizonusa.net, hotmix.org, houread.org, hps.hubbell.com, hpwhite.com, hrassoc.com, hrlinkstaffing.com, htbrown.com, hubbell.com, hubbell-automation.com, hubbell-premise.com, huntsvillelumber.com, hutchinsonleader.com, hutchisoneng.com, i3solutions.com, ibs.com, idahosupreme.com, idomusa.net, ieiusa.net, ieserve.com, illiniline.com, ilprincipals.org, imagesusa.net, imsenv.com, internet-usa.net, intertek.com, intertek-cb.com, intlfinancebank.com, intralinks.com, ipipeline.com, irusgroup.com, isbalgona.com, isk-industries.com, iwsb.com, jacksoncountybank.com, jakesweeney.com, jaxbank.com, jbfsir.com, jdcu.com, jgiordano.com, jimcookchevrolet.com, journalscene.com, juliabfee.com, kandrindustries.com, kawvalleybank.com, kearneytrust.com, kecu.org, kens5.com, king5.com, kingstonnationalbank.com, ktfcu.org, kvfcu.org, labsphere.com, laccm.org, landisconstruction.com, larkin-grp.com, letsdish.com, lhh.com, libertysavings.com, lilleyinternational.com, loissilva.com, lormet.com, lsfcu.net, magellanbio.com, mainefamilyfcu.com, malagabank.com, maloneheatandair.com, manasquanbank.com, manhattanpharma.com, marioncountysavings.com, markerseven.com, mastermolding.com, mastersvillas.com, matrixusa.net, mavtv.net, mccandlaw.com, mcleodusa.net, mcs-bank.com, mcstorage.com, mdcarchitects.com, mem.com, membersheritage.org, memfirstcu.com, meritusa.net, merrick.com, mesaland.com, metcare.com, metroninc.com, mghassociates.com, millburycu.com, mission-controls.com, mmdusa.net, mobilemarketing.com, moneyonefcu.org, morebankusa.com, msdelta.com, msi-na.com, mssarchitects.com, mtcu.org, multiplexinc.com, murphyobrien.com, mvlegal.org, mvp4me.com, mybankcnb.com, my-broker.com, myfarmersbank.net, mysistersplacedc.org, mytrubank.com, nacps.com, naecu.org, natureusa.net, nbausa.net, nbchgo.com, nbcoxsackie.com, nbnyc.com, neafcu.org, neilenterprises.com, nesec.com, netsouth.cc, netsouth.com, netsurfusa.net, newriverbuilding.com, nhaudubon.org, niederhoffer.com, norcal.usta.com, normansound.com, novatc.org, ochome.com, oldmobank.com, oleen.com, olsten.com, omnibankna.com, oneidabank.com, otisfcu.org, otsusa.net, ourhometownbank.com, out.com, owencom.com, owlwire.com, ozarkbank.com, pacesetterusa.net, pacificearth.com, pacificglobalbank.com, pacificrimusa.net, palmettosouth.com, paragonlighting.com, pataskalabank.com, patient-education.com, patlane.com, pcpusa.net, pctusa.net, pdiusa.net, pdr-usa.net, pedsny.com, peoplesstate.com, pfcu.org, pfeifferelectric.com, pfmills.com, phoenixaccessories.com, phoenixhecht.com, phoenixsavings.com, phs-us.com, pilotgrovesavingsbank.com, pimaheart.com, pinnacol.com, pioneer-bank.com, pioneerbks.com, pira.com, plantationfederal.com, pnbk.com, pngusa.net, polestarmortgage.com, polkcountybank.com, polybrite.com, polytechae.com, porterschapel.com, poshcondos.com, precisionfluorescent.com, premierpower.com, primeair.com, primevest.net, princetoninformation.com, procure.com, promediausa.net, protectusa.net, pro-usa.net, prudentialga.com, prudentialgeorgia.com, prupremier.com, psb-ebank.com, pssckids.org, pt-usa.net, pulsetrading.com, qben.com, qtionline.com, queenstown-bank.com, quoinbank.com, ramseybank.com, realtyexecsrelo.com, realtyexecutives.com, recommind.com, redriverwaterway.com, regententertainment.com, rehabteam.com, remonks.com, reohp.com, rfcu.com, ridgewoodbank.com, rimonthly.com, risris.com, riverfrontcj.com, rjjenkins.com, rmb.com, rmbproducts.com, rmwins.com, rockwoodbank.com, rosellesavings.com, ruralusa.net, rwgusa.com, safety-center.org, sandraweir.com, sanjac.net, sankyo-usa.net, sca-usa.net, scbancorp.com, schaffpiano.com, scottsystem.com, sdc-cs.com, sdiusa.net, seamensbank.com, security-savings.com, selecttelecom.com, semills.com, servicestarusa.net, sewickleysavingsbank.com, sheprealty.com, sherronassoc.com, showersgroup.com, sibor.com, silvarealestate.com, simsburybank.com, skildmfg.com, skylinewindows.com, sloveniansavings.com, smartcu.org, smcpackaging.com, smcschool.org, smra.com, sns.com, somobank.com, sosb-ia.com, sothebysrealty.com, soundbanking.com, soundbanking.net, southerncommercial.net, southernpage.net, southportbank.com, southwestnb.com, spatialinfo.com, sportline.com, sportsdisplay.com, springfieldstate.com, staffingindustry.com, stagnito.com, starelec.com, stargazer.net, statebankonline.net, statemortgage.net, statesavingsbank.com, std-displays.com, stellarfinancial.com, stephensfederalbank.com, sterncassello.com, storserver.com, suburbantire.com, sunbelt-usa.net, superiortouch.com, swc.edu, swfcb.com, T2usa.net, tableausoftware.com, tcbank.com, tcfcu.com, teamcapitalbank.com, teamonejobs.com, tefronusa.net, telenetusa.net, tempteeco.com, teriinc.org, texas.usta.com, texasnational.com, texfed.com, tfharper.com, tfssl.com, theasianbank.com, thebreakawaygroup.com, thecheesecakefactory.com, thewiltonbank.com, thewomensclub.com, thomaswest.com, thycotic.com, tier1inc.com, timent.com, tipcopunch.com, tiusa.net, tli-usa.com, tolerx.com, tolic.com, totalbank.com, totalusa.net, tpayne.com, tpm-usa.net, traditioncm.com, traftonacademy.org, trailsandpaths.com, treasuremart.com, tsbot.com, tsne.org, ttusa.net, turningpointsforchildren.org, txcn.com, ubsmt.com, ucss.com, ulstersavings.com, ultimatesupport.com, umusa.net, unionsla.com, unitedbev.com, unitedcommunitybank.com, unitedprairiebank.com, uplandmutual.com, usa.net, usa-bankers.com, uscopower.com, usfibers.com, usmotors.com, usscofcu.net, usta.com, valleybankmt.com, valleyec.com, vcb.com, vhshc.org, vicfirth.com, vicksburg.com, village-bank.com, vipcommercial.com, viprealty.com, vnbnm.com, vwstores.com, washingtonco-op.com, washingtonelectric.coop, washingtonsav.com, wec.coop, wecenv.com, weissbluth.com, wellmanproducts.com, wellogic.com, westwatercorp.com, wffcu.org, whcu.com, whereibank.com, whitehatsec.com, williamhenrystudio.com, windowco.net, wingzone.com, wjbradley.com, wmls.org, wonicarealtors.com, workcard.com, worldmedia.net, worldtravelservice.com, wrd.state.or.us, wyantdata.com, xcelfcu.org, xfoneusa.net, yaffeco.net, yankeebarnhomes.com, ymcausa.org, youradventureinc.com, zlcs.org, zsz.com

<domain \$usa>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors  
  dkim-sign yes
</domain>

# domains that resolve to rockspace.com
domain-macro rockspace rockspace.com, heartsine.com
<domain \$rockspace>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors  
  dkim-sign yes
  deliver-local-dsn yes
</domain>

# domains that resolve to bluetie
domain-macro bluetie bolandtire.com, bonesco.com, bonfield.biz, bradbaxter.com, branchfirerescue.org, brandxnet.com, braystire.com, broadcastpix.com, brophyinc.com, brushwolf.com, bsunsets.com, buntingandmurray.com, buntingconstruction.com, butlertireinc.com, buyourbiz.com, buypremiereplastics.com, bvsa.org, c21act3.com, c2i2.com, caffeclassicofoods.com, cainstire.com, camdencountynutritionproject.4t.com, camdenparking.net, campcrescendo.com, carolina.net, casetireco.com, cbwalsh.com, ccc-cable.net, ccsminc.com, ccsport.com, centerstarfire.org, centralmedicalpa.com, championroswell.com, chcmed.com, cheneytire.com, chicagotire.com, churchvillefire.com, clatskaniepud.com, clevehillauto.com, clinical1.com, clipsclamps.com, cmi-labs.com, coastalsupplyinc.com, cobrawelltesters.com, cokely.8k.com, colonialroofingny.com, colprinting.com, commercialtireservices.com, completeeyecareassociates.com, compoundingsolutions.net, concoursbodyshop.com, conduit-electric.com, onvergentlaser.com, cordovafiredepartment.4t.com, corealpha.com, corpinvest.com, corsitire.com, cougars.faithweb.com, countrybusiness.net, courtexplorers.com, coyotehonda.com, cprseagles.org, crossdillontire.com, crystalpoolsinc.com, cse-co.com, ctcx.com, customcontrolmfr.com, customlawn1.com, cwthomas.com, cycleoutfitters.com, delanos.com, delimacoffee.com, dewittconst.com, dionnedavis.com, doorpi.net, doyleshd.com, dukedukeservices.com, eaglesnest.org, eastoverauto.com, ecph.org, edecorp.com, elliottstire.com, elmwoodparklibrary.org, eneslow.com, eradawson.com, esginc.com, excelrealtors.net, excite.com, exodusprisonministry.org, expresstd.com, eyecareprofessionals.net, fast-fwd.com, flexo-graphics.com, floridahomes.bz, fmscycles.com, fordlibrary.org, freeservicetire.com, funbikecenter.com, gamus.com, garaann.com, garrongrounds.com, gillespieandson.com, glendaleharley.com, goodshepherd-school.org, goolsbeetire.com, grandappraisal.com, halsconstruction.com, hapscycle.com, hartsellfh.com, hayflich.net, hayhurstequipment.com, healthcareplus.org, healthcarerxequip.com, heartlandhonda.com, heginc.com, hillelschool.org, hipr05.com, hkrevit.com, hmiusa.com, homehelpers.cc, homemedicalsupply.com, hondaeasttoledo.com, hotbuttonrealty.com, hotwiremail.net, nline.com, hudmgt.com, independentreos.com, info.com, ireach.5u.com, iwon.com, jacksonweldingsupply.com, jansonequipment.com, jdnorthrup.com, jeffsellsaz.com, jensenssupperclub.com, jgbhose.com, jimwhiteheadtire.com, johnsonpoolsandspas.com, jtmanagement.com, kathywalsh.com, kearneyeye.com, kehillastorah.org, keithcarrollrealestate.com, khindustries.com, killiansinc.com, klimatmasterpools.com, lasvegasframing.com, lauriesshoes.com, leesfeed.com, leetetire.com, lewistonpd.org, libertytax.com, lilclandscaping.com, longbeachmotorsports.com, lopezroofing.com, maccaferri-usa.com, mac-env.com, macsgrill.com, maidenfoundry.com, maineradiator.com, majesticpools.com, mariostileandmarble.com, maritaseaandski.com, marrashomecare.com, martenscorp.com, martin-iati.com, massini-group.com, mattinglylumber.com, maukgroup.com, mcgrathpowersports.com, mcknighttire.com, mdverb.com, megalink.net, melissakford.com, mermaidpoolsinc.com, micucci.com, milessupply.com, mjels.com, mjfoleyco.com, mohawkrubber.com, montanacraneservice.com, monteauxs.com, moonlitecycles.com, morrisontruck.net, mountainmachineworks.com, mpks.net, mtvieweq.com, mvpinternet.com, mwest.org, mycreditunion.com, myfacs.7p.com, myfloridapropertystore.com, mysocalhome.com, myterracom.com, myway.com, naavinc.com, neokraft.com, neoshopowersports.com, nepaging.com, neudynamics.com, nextcomputing.com, nicholsonfun.com, normangeetractor.com, northfield.com, northgreenbushpolice.com, northriversidelibrary.org, northstarsultimateoutdoors.com, nwrail.com, nysais.org, ocpcrpa.org, ohiocycles.com, olcotts.com, oregonrealty.com, osmcg.com, oxfordcountysheriff.com, oxfordnetworks.net, pacificrubber.com, padthai.us, patrons.com, pciconstruction.com, pcimiami.com, peregrine-surgical.com, perkinsmedicalsupply.com, pleasanthillsgolfcourse.com, poolside.biz, poolstuffplus.com, popperealty.com, portfolio1031.com, portlandluggage.com, powderpaintme.com, powersportseast.com, prairietrailslibrary.org, precisionmethods.com, primesitebusiness.com, psnw.com, pulseresearch.com, purestat.com, raisinrack.com, ramsinc.com, raystire.com, razzolink.com, rballen.com, rbj.net, redburntireco.com, reedvillecafe.com, reedvillecatering.com, refassociates.com, rehabco.net, reliablecredit.com, retothemax.com, reumail.com, rileyparktire.com, rjsportandcycle.com, rmsa.iwarp.com, rockridgerx.com, rolandstire.com, rosenaupowersports.net, rpainc.biz, rsvp.com, rumfordpd.com, santafeglass.net, savemoneyrochester.com, schietsmotors.com, schlegelemi.com, scottsdalehiphotel.com, seanshuemate.com, seapointe.net, sedamtire.com, seminolepowersports.com, serenemobility.com, sherrytietjensrealtor.com, shopwestsidehonda.com, showcaseproperties.com, simplysellingparadise.com, southwestoralsurgery.com, stagnesschools.org, starcitymotorsports.com, state8.com, stefanourealtors.com, stormyhillharley.com, strainrite.com, sunrushconstruction.com, sunshinehouseinc.com, talktotucker.com, tatsudaiga.com, taxbusters.com, terpstrasales.com, thegoldkeyrealty.com, thegourmet.4t.com, thegreatimpasta.com, hehaystation.com, herrell.com, three-m.com, timpharley.com, tinavasu.com, tingley.net, tiredistributors.com, trashco.com, trimanindustries.com, truckrefrigerationrepair.com, tuckermortgage.com, tucoemas.com, tucoemas.org, ucom.com, uigolf.com, usadatanet.et, valencialumber.com, vallelymarine.com, valleymortgageinvestments.com, vargasbellevuedrug.com, vfcgal.org, videorefurbishing.com, viptruckcenter.com, vy-tek.com, warnertcommercial.com, waynerespiratory.com, wbgc.8m.com, websealinc.com, weichertandrews.com, westmeadepools.com, westsidetire.net, wetplanet.com, wildriverrealty.com, wildwesthonda.com, willisdistributing.com, wilsonwaytire.com, wolfeye.com, woodridgelibrary.org, woodstowing.com, wwtireservice.com, wwwebservice.net, wyomingmillwork.com, ycamps.org, yerkes-assoc.com, youngeng.com, yourservicesd.com, zolabistro.com

<domain \$bluetie>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors  
  dkim-sign yes

</domain>

# domains that resolve to outlook
domain-macro outlook bobmelvin.com, bobpikegroup.com, bocafla.com, bodymedia.com, bo-jac.com, boldinitiative.org, bollin.com, bomusd.k12.ca.us, bomusd.org, bonanzamotors.com, bondfluidaire.com, boone.kyschools.us, bordergrill.com, border-states.com, boston-power.com, bostonunionrealty.com, bownegroup.com, boxlight.com, boyceexcavating.com, boyd.kyschools.us, boydcontreras.com, boyertownymca.org, boykin.com, boyle.kyschools.us, bozzutoinsurance.com, bpcdm.com, bracken.kyschools.us, braddstrelow.com, bradleyrealestate.com, bradleyrealtors.com, bradysandahl.com, branch-isd.org, brandiqinc.com, branstetterlaw.com, breathitt.kyschools.us, breck.kyschools.us, bremertonschools.org, brendasprankel.com, brennerexcavating.com, briar-group.com, brickschools.org, brickstonerealty.net, bridgeheadsoftware.com, bridge-rayn.org, bridgeviewit.com, brightbeginningsinc.org, bristolva.org, britspub.com, brittmorrishomes.com, broaster.com, brocach.com, brokaw.com, broncos.uncfsu.edu, broncs.utpa.edu, brookside-agra.com, brownhardman.com, brownsburg.k12.in.us, brs-llc.com, brunowhite.com, brushresearch.com, bsa.org, bsc.edu, bsschool.org, btginc.com, bua.edu, buckeyeschools.info, buckinghamgreenery.com, bucklarchitects.com, buddyblake.com, buffalowildwings.com, buffingtonhomes.com, buffspec.com, bugmanarkansas.com, buildinginnovationsgroup.com, builtins.com, bulhed.com, bullrealtor.com, bullrun-metal.com, bulmanproducts.com, burgon.com, burkburnettisd.org, burkeproperties.com, burkwald.com, burkwood.com, burnettrealestate.com, burnthickory.com, burrisequipment.com, burrwhite.com, burtonfloor.com, businessjetcenter.com, businessmovesolutions.com, butler.kyschools.us, butlertechnologies.com, buysarasota.com, bvhg.com, bwbcontrols.com, byron.k12.mi.us, caasnm.org, cabarruscollege.edu, cablecominc.com, cabreraservices.com, cabrillomortgage.com, cacoatings.com, cactusrestaurants.com, cactxsurfaces.com, caeonline.com, calabreseandcalabrese.com, cal-chlor.com, calcoastal.org, caldwell.kyschools.us, caldwell-nj.com, caledoniabay.com, calicoweb.com, callcale.com, callcia.com, calljodi.com, calloway.kyschools.us, calsaw.com, calstripsteel.com, camanokeri.com, cambridgemsi.com, cambridgepublicschool.com, cambridgeus.com, camcoconstruction.com, camdencountymuseum.com, camelbackdesertschools.com, cameronbutcher.com, caminoschool.org, campbell.kyschools.us, campbellsurvey.com, campforall.org, campos.com, campronaldmcdonald.org, canalcartage.com, candacerubin.com, cantonagency.com, canyonresources.com, canyonsolutions.com, caodmu.org, capefearcommercial.com, capital.k12.de.us, capitalcleaning.com, capitalcommercial.com, capitalinvestments.net, capitalregroup.com, capitollook.com

<domain \$outlook>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h
  smtp-pattern-list blocking-errors  
  dkim-sign yes
  deliver-local-dsn yes
</domain>



domain-macro racsa ccss.sa.cr, ns.isi.ulatina.ac.cr, sol.racsa.co.cr, ns.ulatina.ac.cr, costarricense.cr, racsa.co.cr, ice.co.cr, bncr.fi.cr, ccss.sa.cr, racsa.co.cr, costarricense.cr
<domain \$racsa>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
	
    dkim-sign yes
</domain>


domain-macro terra terra.com, terra.com.ar, terra.cl, terra.com.pe, terra.es, terra.com.mx, terra.com.br, terra.com.co, terra.com.uy, speedy.com.ar, speedy.com.pe, telefonica.net, infonegocio.com, infosel.net.mx, infosel.com.mx, terramail.com.pe, ctcinternet.cl, teleline.es, infovia.com.ar, satlink.com, ctcreuna.cl, overnet.com.ar, topmail.com.ar, infonegocio.com.pe, satlink.com.ar, cpsarg.com, ole.com, cv.cl, bancomer.com, telefonica.com.ar, repsol.com, telefonica.es, chilectra.cl, tsm.es, tsai.es, race.es, nh-hotels.com, bancopopular.es, databasedm.es, iies.es, advancedsl.com.ar
<domain \$terra>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
	
    dkim-sign yes
</domain>

domain-macro prodigy prodigy.net.mx, infinitum.com.mx, prodigymedia.com, infinitummail.com, correoinfinitum.com, infinitumzone.net, correoprodigy.com, ameritech.net, flash.net, pacbell.net, prodigy.com, prodigy.net, snet.net, swbell.net, telnor.net, uninet.net.mx
<domain \$prodigy>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
	
    dkim-sign yes
</domain>


domain-macro entelchile entelchile.net, 123mail.cl, entelchile.cl, 123.cl, 123click.cl, entel.cl, 123.com, nt.entel.cl, carabineros.cl, consorcio.cl, finning.cl, sqm.cl, dgac.cl, construmart.cl, abretumundo.cl, entelchile.com, agrosuper.com, cocha.com, minpublico.cl
<domain \$entelchile>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
	
    dkim-sign yes
</domain>

domain-macro avantel avantel.com.mx, avantel.net, avantel.net.mx, axtel.com.mx, hacienda.gob.mx, diconsa.gob.mx, insp.mx
<domain \$avantel>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro puc puc.cl, uc.cl, ing.puc.cl, alumni.uc.cl, med.puc.cl, ing.uc.cl, iglesia.cl, lascar.puc.cl
<domain \$puc>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro vtr vtr.net, mi-mail.cl, mi.cl, vtr.cl
<domain \$vtr>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro metrored metrored.mx, internet.com.mx, netmex.com, data.net.mx, mx.inter.net, psi.net.mx, cablecom.com.mx
<domain \$metrored>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro uol uol.com.mx, uol.cl, uolsinectis.com.ar, uol.com.ar, sinectis.com.ar, sion.com, datafull.com, sion.com.ar, uol.com.br, zip.net, uol.com
<domain \$uol>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro arnet radar.com.ar, telecom.com.ar, arnet.com.ar, lacaja.com.ar, arnetbiz.com.ar, ta.telecom.com.ar
<domain \$arnet>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

# domains that resolve to (alt?.)comcast network
domain-macro att  att.net, att.com, bobitees.com, bollerconstruction.com, boswellsharley.com, boyterinsulation.com, bradfordbank.net, braidwoodrecclub.com, brennantools.com, brevardtaxcollector.com, brightonbest.com, brittainmachine.com, broadband.att.com, brownsinteriors.net, bscc.bls.com, bustech.com, bwwlaw.com, bwwmh.com, c21ir.com, cabreracapital.com, caldwellthompson.net, callftx.com, calpoison.org, camail.sbc.com, cameronmitchell.com, captivasoftware.com, carcitycpd.com, carolinatrust.com, carydermatology.com, cassityjones.com, cbtgrainger.com, cccera.org, cccoolers.com, cce-llc.com, ccn-law.com, cdgroup.com, centralbuilders.net, centralmoloneyinc.com, centurycontainer.com, cgreen.com, cgwitvoet.com, chagdetroit.org, charliesautoglass.com, charliesbar.com, charterbankcc.com, chickasaw.coop, childersburg.org, ci.cerritos.ca.us, ci.chowchilla.ca.us, ci.seguin.tx.us, cingular.com, ckchicago.org, claengineers.com, claycountytax.com, clearingcorp.com, cmg-pc.com, cmnsteel.com, cngmail.cingular.com, co.collin.tx.us, co.madison.oh.us, co.merced.ca.us, co.sebastian.ar.us, cobenelectric.com, cobracap.com, colemanland.com, colonialtitlecompany.com, commercialmfg.com, compassaerospace.com, completetruckbodies.com, com-power.com, comspecinc.com, conceptframing.com, conchango.com, contractorscargo.com, cook-mfg.com, copesan.com, copypro.com, corebanking.net, corp.sbc.com, cortest.com, courtesybldgservices.com, craigschools.com, craneco.com, crawforddoorsales.com, cr-cpa.com

<domain \$att>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors  
  dkim-sign yes
</domain>

domain-macro wanadoo wanadoo.es, mixmail.com, eresmas.com, jet.es, jazzfree.com, ya.com, eresmas.net, ctv.es, orange.es, demasiado.com, telepolis.com, apdo.com, orangemail.es, uni2.es
<domain \$wanadoo>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro sedoparking sedoparking.com, guay.com, daz.com.ar, ze.cl, mecon.com.ar, interactive.com.ar, interactiva.cl, sinfo.net, lua.com.ar, tutopia.com.ar, upa.cl, ufasta.com.ar, unsa.com.ar, selectett.es, accesosis.es, cconline.es, globalnet.es, interplanet.es, iberonline.es
<domain \$sedoparking>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro telmex telmex.net.pe, bonus.com.pe, pucp.edu.pe, sunat.gob.pe, minedu.gob.pe, xploratelmex.com.pe, gym.com.pe, minsa.gob.pe, mef.gob.pe, ferreyros.com.pe, fasa.com.pe, ripley.com.pe, creditex.com.pe, mtc.gob.pe, mincetur.gob.pe, cmr.com.pe, sni.org.pe, bif.com.pe, bancomercio.com.pe, aduanet.gob.pe, sanpablo.com.pe, glencore.com.pe, cofide.com.pe, pcm.gob.pe, imarpe.gob.pe, epensa.com.pe, drokasa.com.pe, promperu.gob.pe, gruponuevomundo.com.pe, hersil.com.pe, adexperu.org.pe, sat.gob.pe, webtelmex.net.mx, telmex.net, telmex.com.mx, reduno.com.mx, telmexchile.cl, rhi.cl, chilesat.net, chilesat.cl, alemana.cl, telmexla.net.co, cable.net.co, telmex.com, telnor.com
<domain \$telmex>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro lycos mailcity.com, eudoramail.com, lycos.com, angelfire.com, lycos.es
<domain \$lycos>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro earthlink earthlink.net, netcom.com, jps.net, mindspring.com, thegrid.net, lightspeed.net, sprintmail.com
<domain \$earthlink>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro ono ono.com, supercable.es, ono.es, menta.net, auna.com, able.es, usuarios.retecal.es, retecal.es
<domain \$ono>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro fibertel fibertel.com.ar, cvtci.com.ar, citynet.net.ar, datamarkets.com.ar, lanet.com.ar, dynamo.com.ar
<domain \$fibertel>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro telecentro telecentro.com.ar, 2vias.com.ar
<domain \$telecentro>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro gmx mail.com, gmx.net, iname.com, email.com, caramail.com, usa.com, usa.net
<domain \$gmx>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro racsa ccss.sa.cr, ulatina.ac.cr, racsa.co.cr, costarricense.cr, ice.co.cr, bncr.fi.cr
<domain \$racsa>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro latinmail latinmail.com, starmedia.com
<domain \$latinmail>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

domain-macro voodoo voodoo.com, intermex.com.mx
<domain \$voodoo>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

<domain videotron.ca>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

<domain home.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
	max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
</domain>

<domain ukonline.co.uk>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain freemail.hu>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain operamail.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain okabsolute.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain viabcp.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain intercable.net>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain chilnet.cl>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain millicom.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain ciudad.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain pvnet.com.mx>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain televisa.com.mx>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain rcc.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain impsat.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain osde.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain lanacion.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain chile.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain amc.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain sdm.net.mx>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain ec-red.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain arrakis.es>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain interlap.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain crm.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain mecon.gov.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain disco.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain megared.com.mx>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain amauta.rcp.net.pe>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain cordoba.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain todito.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain tutopia.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain universia.edu.pe>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain bbvnet.com>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain iteso.mx>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain reuna.cl>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain cba.gov.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain itesm.mx>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain elistas.net>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain netverk.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain bancogalicia.com.ar>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

<domain tp.com.pe>
    max-msg-rate $PMTALimit/h  # prevent \"exceeded the rate limit\"
    max-smtp-out   10
    max-rcpt-per-message 10
    max-msg-per-connection   10
    max-errors-per-connection 4
    max-connect-rate 5/m
</domain>

# domains that resolve to juno
domain-macro juno creativeworldschool.com, dav.org, davmail.org, juno.com, juno.net, junoinc.com, junolightinggroup.com, juno-tech.com, math.msu.edu, netzero.net, netzero.com, zip-net.com

<domain \$juno>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 10  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h
  smtp-pattern-list blocking-errors
  dkim-sign yes

</domain>

# domains that resolve to excite
domain-macro excite excite.com, excitehome.net, mailexcite.com, whitewaterexcitement.com

<domain \$excite>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h
  smtp-pattern-list blocking-errors   
  dkim-sign yes
</domain>



# domains that resolve to comcast
domain-macro comcast bobcatboston.com, bodinetool.com, boises.com, bouchillon.com, bourasind.com, bowdoinfestival.org, brassplater.com, brentadvisors.com, broudyprecision.com, brumbleyappraisals.com, brynolfmanufacturing.com, bta.bz, btr-cpas.com, burkerealtyllc.com, burke-sons.com, burrbros.com, buyers-edge.com, bwstetson.com, c21larrymiller.com, c21sd.us, cable.comcast.com, cabotreserve.org, callanderassociates.com, canfieldequipment.com, capecodalarm.com, capitalnursery.com, capitolresearchservices.com, capraelectric.com, cardinalgroup.net, carusopaving.com, cashbuildingmaterial.com, cbcnj.org, cbcrealty.com, cbgear.com, cbhlmadera.com, ccoel.org, ccrmanagement.com, ceciltownship.com, cedarsidinginc.com, cedpackaging.com, celcorealestate.com, centralbaptistministries.org, century21discover.com, ces-mac.com, changyang.comcastbiz.net, checkerscatering.com, chestnuthomes.com, chiefstowing.com, chrismarr.com, christianchristopher.net, christinemurphyteam.com, chsinc.net, clairesinclair.com, clarkbrothers.net, cleanresponse.com, coatsandcoats.com, cobbrealtor.com, collegeboundfoundation.org, collinsdistributing.com, comcast.com, comcast.net, comcastsportsnet.com, comcastspotlight.com, commonwealthlock.com, compassinternational.net, conceptsunlimited.com, cordovagc.com, cornerstoneeagles.com, countryestatesinc.com, cpnef.org, creativeconservation.com, crestpaper.com, crockerelectrical.com, crossingumc.org, crossroadsprograms.org, cstmont.com, ctmgroupinc.com, CULLIPINDUSTRIES.COM, cwfritz.com, daintyrubbish.com, dasgroupinc.com, dbsforms.com, dedhamclub.org, degroot-inc.com, dehamerbros.com, delvalappraisal.com, developersgroup.org, dew-realty.com, dielectricsolutions.com, dieselcastwelding.com, dinstuhls.com, directtiresales.com, diskinproperty.com, dlappraisals.com, dmflowers.com, dolarian.com, dorothyscandies.com, doylestownpa.org, drakescreekmarine.com, dreamlandip.com, ducomelectric.com, ductshopinc.com, duffylaroe.com, dunningkirrane.com, eagleproperties.net, easternanimalhospital.com, easternindustries.com, easternscience.com, easthill.net, ebriggslaw.com, edge-corp.com, elchristian.org, elliergonzalez.com, elmiassociates.com, elmlaw.com, emwc.org, enmarktool.com, enrollmentrx.com, ensourcecorp.com, erastatewiderealty.com, erc-concepts.com, eschergroup.com, estassociates.com, ethridgeenterprises.com, ethyleneatlantic.com, euro-suites.com, eutsler-rubber.com, evans-sherratt.com, exclaim-inc.com, ezenia.com, fabriform.com, familychurch.org, fascollections.com, fastonline.com, fencorgraphics.com, fiesta.comcastbiz.net, financialspectrum.com, firstmetro1.com, firststepmd.com, flamco.com, flavormaterials.com, flgulfside.com, flinndreffein.com

<domain \$comcast>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h
  smtp-pattern-list blocking-errors  
  dkim-sign yes
 </domain>

# domains that resolve to cox
domain-macro cox bobmaloney.com, bonders.com, boucherrealestate.com, bowmanco.com, bplmautos.coxatwork.com, bradfordrefi.com, brcoxmail.com, brennan.sdcoxmail.com, brianrealty.necoxmail.com, brickrowmgt.com, broadwayclinic.com, brokerbob.net, brsa.org, brunercox.com, burnsappraisal.com, bussartrealty.kscoxmail.com, bwbrentals.gccoxmail.com, c21.kscoxmail.com, c21butler.net, c21markv.com, cacrc.com, caetano.necoxmail.com, callahansteel.com, callhawks.com, camincusa.com, campbellrealty.roacoxmail.com, candacecan.com, cannonhomes.omhcoxmail.com, canvasstore.com, capc-pensacola.org, capitalconcreteinc.com, capitalgraphics.com, capitalrubber.com, capitollitho.com, cappsmfg.com, capraroappraisal.com, cardinal.hrcoxmail.com, cardinalrubber.com, carlcoxhomes.com, carlinolaw.com, carrollbusinesssupply.com, casafamiliar.org, cassconstruction.com, cbd.mgacoxmail.com, cbi.mgacoxmail.com, cc.brcoxmail.com, cchne.com, ccre.kscoxmail.com, cdiri.com, cecilmillerappraisals.com, centerinthesquare.org, centrecityproperties.com, century21.gccoxmail.com, century21.omhcoxmail.com, cewc.sdcoxmail.com, cfwcardiff.com, chaderealty.com, chamberschool.com, chapmanlindsey.com, charco.com, charcrane.net, charlesstallions.com, cheneyks.org, childrensdentistry.com, churchdesign.com, ci.encinitas.ca.us, citieswestpub.com, cityofdelcity.com, cityofencinitas.org, cityofmaryesther.com, citywide.lvcoxmail.com, civilworksonline.com, ckls.org, clcarterheatingandair.com, cma.sdcoxmail.com, cmi.necoxmail.com, cogankibler.com, cokesburyumc.org, coldwelbanker.sdcoxmail.com, coldwellbankerhancocks.com, collegehill.necoxmail.com, columbiaexport.net, communitycovenantchurch.org, comprorealty.com, compumaticsgroup.com, computerinnovationsinc.com, comstar-inc.com, conchitasulli.net, continentalri.com, contractorsupply.com, conwaytours.com, cookvw.com, copeland.kscoxmail.com, cornerbroker.com, cornerstone.sdcoxmail.com, counterstone.org, courtleyjacksonco.com, coventrypd.org, cox.cc, cox.com, cox.net, cox1.net, coxandassociates.biz, coxanddinkins.com, coxandfloyd.com, coxcastle.com, coxconstruction.com, coxconventioncenter.com, coxcorealestate.com, coxenterprises.com, coxhardware.com, coxhealth.com, coxhealth.net, coxinc.com, coxinet.net, coxinteriors.com, cox-internet.com, coxlawgroup.com, coxmail.com, coxmedia.com, coxmillwork.com, coxmotors.net, coxnews.com, coxnewspapers.com, coxohio.com, coxpaper.com, coxpetroleum.com, coxprinters.com, coxradio.com, coxreadymix.com, coxrec.com, coxreels.com, coxsharley-davidson.com, coxsheetmetal.com, coxsupermarket.com, coxtampa.com, coxtarget.com, coxtoyota.com, coxwalker.com, coxwood.com, coyleappraisal.com, cpi.kscoxmail.com, cpm.occoxmail.com

<domain \$cox>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h
  smtp-pattern-list blocking-errors  
  dkim-sign yes
</domain>

# domains that resolve to earthlink
domain-macro earthlink booksofwonder.com, boss-online.com, brant-allen.com, brevard.net, butternutfarm.com, bwsys.net, californiaexport.com, californiawreath.com, capecod.net, cascorealty.com, ccphotocopy.com, cendevkids.com, certifiedfire.com, chaparral.com, chesapeake-montessori.com, chrisaoki.com, cipbattery.com, cliffordgroup.net, cliffsidebody.com, commercial-lessors.com, conejovet.com, corlettlumber.com, crookandchase.com, ctlnet.com, cvivet.org, cvn.net, delanet.com, denverdreamhomes.com, designology.com, desupernet.net, dexwine.com, dipen.com, doehrman.com, dstream.net, early.com, earthlink.com, earthlink.net, edhassoc.com, edsmfg.com, enovaengineering.com, erapacesettersnc.com, erwinkeith.com, e-salads.com, ezonline.com, fcc.net, fgi.net, floridahomes-land.com, foxbendgolfcourse.com, fpifilters.com, frchemical.com, friendschristian.org, gilbertharrelllaw.com, glendalememorial.com, goodearthlink.com, grodenstamp.com, grovedale.com, hairdyes.com, hit.net, hojomaine.com, horizon.hit.net, hubregsen.com, humblechristianschool.org, iag.net, ifds.com, indy.net, iopener.net, itapartners.com, iti-ndt.com, ix.netcom.com, jarque.net, jeffkoonsart.com, jps.net, kpkcommercial.com, ldd.net, legal-aid.org, lightspeed.net, linhadley.com, lisafriedman.com, livingstonpipeandtube.com, lumberjake.com, lynnebilling.com, mailstation.com, marinersbk.com, mcn.net, mcwilliamsrealty.com, midwest.net, mycidco.com, mymailstation.com, mypacks.net, myvine.com, nafunding.com, nemonet.com, newarkdental-pemco.com, oes-corp.com, omniyig.com, onemain.com, opsup.com, oxridge.com, palmnet.net, paramountag.com, paramountfabricators.com, parquet.com, patriotsubaru.com, peoplepc.com, peoplepchq.com, peterriolo.com, philsteele.com, pjgreen.com, plasticsmachining.com, pmf.com, polyscapes.com, predicate.com, prolabresources.com, pyramidcement.com, ratheassoc.com, redrose.net, rnet.com, robinsontoyota.com, robix.com, roblaeace.com, rossnameplate.com, royalairsystems.com, ruralmedicalservices.org, sav-onplating.com, securpros.net, sensor-tech.com, shianet.org, shoppingmart.com, sierraleasing.com, slater-consulting.com, snowaviation.com, soccoplastics.com, southjerseyhomes.com, southwind.net, spmproperties.com, sprintmail.com, stillwater.com, stonesoap.com, suburbanpublishing.com, supernet.com, syntek-usa.com, teambuildingthatworks.com, teampanattoni.com, teleport.com, testing-engineers.com, thegrid.net, threadspecialties.com, tir.com, transconcargo.com, trese.com, trinity-school.net, tukatech.com, twdev.com, uga.com, uniquelampsonline.com, urbancos.com, usit.net, usmo.com, vartali.com, vickerys.com, wanda-kalman.com, watertownengineering.com, webspan.net, weeklynews.net, yorkproperties.com

<domain \$earthlink>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  dkim-sign yes
  </domain>

# domains that resolve to roadrunner
domain-macro roadrunner ca.rr.com, carolina.rr.com, centexbiz.rr.com, cfl.rr.com, cflbiz.rr.com, cinci.rr.com, columbus.rr.com, dc.rr.com, ec.rr.com, elmore.rr.com, elp.rr.com, eufaula.rr.com, gt.rr.com, hawaii.rr.com, hawaiibiz.rr.com, hot.rr.com, houston.rr.com, hvc.rr.com, indy.rr.com, insight.rr.com, kc.rr.com, ma.rr.com, maine.rr.com, mass.rr.com, mi.rr.com, nc.rr.com, ne.rr.com, neb.rr.com, neo.rr.com, new.rr.com, nj.rr.com, nyc.rr.com, nycap.rr.com, oh.rr.com, pa.rr.com, panhandle.rr.com, rgv.rr.com, rochester.rr.com, san.rr.com, satx.rr.com, sc.rr.com, si.rr.com, socal.rr.com, stny.rr.com, stx.rr.com, sw.rr.com, tampabay.rr.com, triad.rr.com, triadbiz.rr.com, twcny.rr.com, twmi.rr.com, tx.rr.com, we.rr.com, wi.rr.com, woh.rr.com

<domain \$roadrunner>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 9  # max 500 mails in one session
  max-errors-per-connection 10  # avoid 'too long without data command' error

  max-msg-rate 9/m

  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  smtp-421-means-mx-unavailable yes
  smtp-553-means-invalid-mailbox yes
  bounce-upon-5xx-greeting true
  connect-timeout 1m
  smtp-greeting-timeout 5m
  data-send-timeout 5m
  retry-after 30m  # typical greylisting period
  bounce-after 15d  # default 4d12h

  smtp-pattern-list blocking-errors
  

  
  dkim-sign yes
 </domain>


 <domain satnet.net>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
</domain>


 <domain uio.satnet.net>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain gye.satnet.net>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
</domain>


 <domain andinanet.net>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
</domain>


 <domain telefonica.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
 </domain>


 <domain vistazo.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
  </domain>


 <domain man.cnel.gob.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
 </domain>

  <domain msp.gob.ec>
    max-smtp-out   1
    max-msg-per-connection   1
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  1/h
    backoff-retry-after  30m 
 </domain>
 
 



  <domain mrl.gob.ec>
    max-smtp-out   1
    max-msg-per-connection   1
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  1/h
    backoff-retry-after  30m 
 </domain>

  <domain ant.gob.ec>
    max-smtp-out   1
    max-msg-per-connection   1
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  1/h
    backoff-retry-after  30m 
 </domain>

  <domain cgg.gob.ec>
    max-smtp-out   1
    max-msg-per-connection   1
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  1/h
    backoff-retry-after  30m 
 </domain>

  <domain dpsp.gob.ec>
    max-smtp-out   1
    max-msg-per-connection   1
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10
    backoff-to-normal-after 2h
    backoff-max-msg-rate  1/h
    backoff-retry-after  30m 
 </domain>
 
 <domain glr.cnel.gob.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
 </domain>


 <domain tia.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
 </domain>


 <domain correosdelecuador.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
  </domain>


 <domain sipec.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m 
 </domain>


 <domain telefonica.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain pelikano.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain offsetec.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain eor.cnel.gob.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain bncr.fi.cr>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain prc.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain esm.cnel.gob.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain ec.bureauveritas.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m

 </domain>


 <domain segob.gob.mx>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain cnel.gob.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain mlg.cnel.gob.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain intaco.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain bosch.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain copaair.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain ecuatronix.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain norma.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain latin-gaming.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain lrs.cnel.gob.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain investamar.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain carvajal.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain sistran.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain pi.pro.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain access.net.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain accessinter.net>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain gu.pro.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain bankguay.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain ucsg.edu.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain ug.edu.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain usm.edu.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain loja.telconet.net>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain unidas.com.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain tu.pro.ec>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain eesaci.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain univision.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>


 <domain aim.com>
    max-smtp-out   20
    max-msg-per-connection   100
    smtp-421-means-mx-unavailable yes
    mx-connection-attempts 10 
    backoff-to-normal-after 2h
    backoff-max-msg-rate  100/h
    backoff-retry-after  30m
 </domain>
" > $ArqPmtaConfig

echo "# default domain settings
<domain *>
  max-smtp-out 2  # default be nice on concurrent connections
  max-msg-per-connection 1000  
  max-errors-per-connection 10  # avoid 'too long without data command' error
  max-msg-rate $MaxEnvios/h  # prevent \"exceeded the rate limit\"
  smtp-greeting-timeout 5m
  backoff-to-normal-after 1h
  backoff-max-msg-rate 6000/h
  backoff-retry-after 30m
  bounce-upon-no-mx yes  # proper mail domains should have mx
  assume-delivery-upon-data-termination-timeout yes  # avoid duplicate deliveries
  retry-after 10m  # typical greylisting period
  bounce-after 5d  # default 4d12h
  smtp-pattern-list blocking-errors
  backoff-max-msg-rate 1/m  # send only regular tries during backoff (default unlimited)
  backoff-retry-after 20m  # retry at least every 20m (default 1h)
  backoff-to-normal-after-delivery yes  # revert to normal asap (default no)
  backoff-to-normal-after 1h  # always revert to normal after 1h (default never)
  
  dkim-sign yes
  ignore-8bitmime true
  use-starttls yes
  

" >> $ArqPmtaConfig

echo '</domain>
############################################################################
# END: ISP rules
############################################################################

############################################################################
# BEGIN: BACKOFF RULES
############################################################################

<smtp-pattern-list common-errors>
reply /generating high volumes of.* complaints from AOL/ mode=backoff
reply /Excessive unknown recipients - possible Open Relay/ mode=backoff
reply /^421 .* too many errors/ mode=backoff
reply /blocked.*spamhaus/ mode=backoff
reply /451 Rejected/ mode=backoff
</smtp-pattern-list>

<smtp-pattern-list blocking-errors>
reply /421 .* SERVICE NOT AVAILABLE/ mode=backoff
reply /generating high volumes of.* complaints from AOL/ mode=backoff
reply /554 .*aol.com/ mode=backoff
reply /421dynt1/ mode=backoff
reply /HVU:B1/ mode=backoff
reply /DNS:NR/ mode=backoff
reply /RLY:NW/ mode=backoff
reply /DYN:T1/ mode=backoff
reply /RLY:BD/ mode=backoff
reply /RLY:CH2/ mode=backoff
reply /421 .* Please try again later/ mode=backoff
reply /421 Message temporarily deferred/ mode=backoff
reply /VS3-IP5 Excessive unknown recipients/ mode=backoff
reply /VSS-IP Excessive unknown recipients/ mode=backoff
reply /\[GL01\] Message from/ mode=backoff
reply /\[TS01\] Messages from/ mode=backoff
reply /\[TS02\] Messages from/ mode=backoff
reply /\[TS03\] All messages from/ mode=backoff
reply /exceeded the rate limit/ mode=backoff
reply /exceeded the connection limit/ mode=backoff
reply /Mail rejected by Windows Live Hotmail for policy reasons/ mode=backoff
reply /mail.live.com\/mail\/troubleshooting.aspx/ mode=backoff
reply /421 Message Rejected/ mode=backoff
reply /Client host rejected/ mode=backoff
reply /blocked using UCEProtect/ mode=backoff
reply /Mail Refused/ mode=backoff
reply /421 Exceeded allowable connection time/ mode=backoff
reply /amIBlockedByRR/ mode=backoff
reply /block-lookup/ mode=backoff
reply /Too many concurrent connections from source IP/ mode=backoff
reply /too many/ mode=backoff
reply /Exceeded allowable connection time/ mode=backoff
reply /Connection rate limit exceeded/ mode=backoff
reply /refused your connection/ mode=backoff
reply /try again later/ mode=backoff
reply /try later/ mode=backoff
reply /550 RBL/ mode=backoff
reply /TDC internal RBL/ mode=backoff
reply /connection refused/ mode=backoff
reply /please see www.spamhaus.org/ mode=backoff
reply /Message Rejected/ mode=backoff
reply /refused by antispam/ mode=backoff
reply /Service not available/ mode=backoff
reply /currently blocked/ mode=backoff
reply /locally blacklisted/ mode=backoff
reply /not currently accepting mail from your ip/ mode=backoff
reply /421.*closing connection/ mode=backoff
reply /421.*Lost connection/ mode=backoff
reply /476 connections from your host are denied/ mode=backoff
reply /421 Connection cannot be established/ mode=backoff
reply /421 temporary envelope failure/ mode=backoff
reply /421 4.4.2 Timeout while waiting for command/ mode=backoff
reply /450 Requested action aborted/ mode=backoff
reply /550 Access denied/ mode=backoff
reply /exceeded the rate limit/ mode=backoff
reply /421rlynw/ mode=backoff
reply /permanently deferred/ mode=backoff
reply /\d+\.\d+\.\d+\.\d+ blocked/ mode=backoff
reply /www\.spamcop\.net\/bl\.shtml/ mode=backoff
reply /generating high volumes of.* complaints from AOL/ mode=backoff
reply /Excessive unknown recipients - possible Open Relay/ mode=backoff
reply /^421 .* too many errors/ mode=backoff
reply /blocked.*spamhaus/ mode=backoff
reply /451 Rejected/ mode=backoff
</smtp-pattern-list>

############################################################################
# END: BACKOFF RULES
############################################################################

############################################################################
# BEGIN: BOUNCE RULES
############################################################################

<bounce-category-patterns>
/spam/ spam-related
/junk mail/ spam-related
/blacklist/ spam-related
/blocked/ spam-related
/\bU\.?C\.?E\.?\b/ spam-related
/\bAdv(ertisements?)?\b/ spam-related
/unsolicited/ spam-related
/\b(open)?RBL\b/ spam-related
/realtime blackhole/ spam-related
/http:\/\/basic.wirehub.nl\/blackholes.html/ spam-related
/\bvirus\b/ virus-related
/message +content/ content-related
/content +rejected/ content-related
/quota/ quota-issues
/limit exceeded/ quota-issues
/mailbox +(is +)?full/ quota-issues
/\bstorage\b/ quota-issues
/(user|mailbox|recipient|rcpt|local part|address|account|mail drop|ad(d?)ressee) (has|has been|is)? *(currently|temporarily 
+)?(disabled|expired|inactive|not

activated)/ inactive-mailbox
/(conta|usu.rio) inativ(a|o)/ inactive-mailbox
/Too many (bad|invalid|unknown|illegal|unavailable) (user|mailbox|recipient|rcpt|local part|address|account|mail drop|ad(d?)ressee)/ other
/(No such|bad|invalid|unknown|illegal|unavailable) (local +)?(user|mailbox|recipient|rcpt|local part|address|account|mail drop|ad(d?)ressee)/ bad-mailbox
/(user|mailbox|recipient|rcpt|local part|address|account|mail drop|ad(d?)ressee) +(\S+@\S+ +)?(not (a +)?valid|not known|not here|not found|does not 
exist|bad|

invalid|unknown|illegal|unavailable)/ bad-mailbox
/\S+@\S+ +(is +)?(not (a +)?valid|not known|not here|not found|does not exist|bad|invalid|unknown|illegal|unavailable)/ bad-mailbox
/no mailbox here by that name/ bad-mailbox
/my badrcptto list/ bad-mailbox
/not our customer/ bad-mailbox
/no longer (valid|available)/ bad-mailbox
/have a \S+ account/ bad-mailbox
/\brelay(ing)?/ relaying-issues
/domain (retired|bad|invalid|unknown|illegal|unavailable)/ bad-domain
/domain no longer in use/ bad-domain
/domain (\S+ +)?(is +)?obsolete/ bad-domain
/denied/ policy-related
/prohibit/ policy-related
/rejected/ policy-related
/refused/ policy-related
/allowed/ policy-related
/banned/ policy-related
/policy/ policy-related
/suspicious activity/ policy-related
/bad sequence/ protocol-errors
/syntax error/ protocol-errors
/\broute\b/ routing-errors
/\bunroutable\b/ routing-errors
/\bunrouteable\b/ routing-errors
/^2.\d.\d/ success
/^[45]\.1\.1/ bad-mailbox
/^[45]\.1\.2/ bad-domain
/^[45]\.3\.5/ bad-configuration
/^[45]\.4\.1/ no-answer-from-host
/^[45]\.4\.2/ bad-connection
/^[45]\.4\.4/ routing-errors
/^[45]\.4\.6/ routing-errors
/^[45]\.4\.7/ message-expired
/^[45]\.7\.1/ policy-related
// other    # catch-all
/failed\,5\.0\.0 \(undefined status\)\,x\-pmta\;bounce\-queue/ bad-domain
</bounce-category-patterns>

############################################################################
# END: BOUNCE RULES
############################################################################

############################################################################
# BEGIN: OTHER OPTIONS
############################################################################
' >> $ArqPmtaConfig

echo "postmaster abuse@$Domain
smtp-listener 0/0:2525 

<source 0/0> 
allow-unencrypted-plain-auth yes 
</source> 

sync-msg-create false 
sync-msg-update false 
run-as-root no 
log-file /var/log/pmta/log # logrotate is used for rotation 

<acct-file /var/log/pmta/acct.csv>
#    move-to /opt/myapp/pmta-acct   # configure as fit for your application
#    move-interval 5m
max-size 50M
</acct-file>

# transient errors (soft bounces)
<acct-file /var/log/pmta/diag.csv>
move-interval 1d
delete-after never
records t
</acct-file>

#
# spool directories
#
<spool /var/spool/pmta> 
delete-file-holders yes
</spool> 

http-mgmt-port 1212 
http-access 0/0 admin


#######################################
# END: OTHER OPTIONS
############################################################################


############################################################################
# BEGIN: USERS/VIRTUAL-MTA / VIRTUAL-MTA-POOL / VIRTUAL-PMTA-PATTERN
############################################################################

<smtp-user $SendingUser> 
password $SendingUserPass
source {pmta-auth} 
</smtp-user>

<source {pmta-auth}>
       smtp-service yes
    always-allow-relaying yes
    require-auth true
    process-x-virtual-mta yes
    default-virtual-mta pmta-pool
    remove-received-headers true
    add-received-header false
    hide-message-source true
    remove-header X-PreviewEmail,X-Mailer,X-Mailer-RecptId,X-Mailer-Sent-By,X-Priority
</source>
" >> $ArqPmtaConfig

echo "<virtual-mta-pool pmta-pool>" > $ArqPmtaConfig2
echo "<pattern-list pmta-pattern>" > $ArqPmtaConfig3

for Ip in $IpsPmtaConfig
do
	echo " " >> $ArqPmtaConfig
	echo "<virtual-mta pmta-vmta$QuantConfigPmta>" >> $ArqPmtaConfig
	echo "virtual-mta pmta-vmta$QuantConfigPmta" >> $ArqPmtaConfig2
	echo "mail-from /@$ReverseDNS$QuantConfigPmta.$Domain/ virtual-mta=pmta-vmta$QuantConfigPmta" >> $ArqPmtaConfig3
	echo "smtp-source-host $Ip $ReverseDNS$QuantConfigPmta.$Domain" >> $ArqPmtaConfig
	echo "domain-key default,$Domain,/etc/pmta/$Domain-dkim.key" >> $ArqPmtaConfig
	echo "<domain *>" >> $ArqPmtaConfig
	echo "max-cold-virtual-mta-msg 1000/day" >> $ArqPmtaConfig
	echo "max-msg-rate $HoraxIP/h" >> $ArqPmtaConfig
	echo "</domain>" >> $ArqPmtaConfig
	echo "</virtual-mta>" >> $ArqPmtaConfig
	echo "<domain $ReverseDNS$QuantConfigPmta.$Domain>" >> $ArqPmtaConfig
	echo "</domain>" >> $ArqPmtaConfig
	echo " " >> $ArqPmtaConfig
	QuantConfigPmta=`expr $QuantConfigPmta + 1`
done

echo "</virtual-mta-pool>
" >> $ArqPmtaConfig2

echo "</pattern-list>
" >> $ArqPmtaConfig3

cat $ArqPmtaConfig2 >> $ArqPmtaConfig && cat $ArqPmtaConfig3 >> $ArqPmtaConfig

mv /tmp/dkim-default /etc/pmta/$Domain-dkim.key
chown pmta:pmta /etc/pmta/ -R

service pmta start
service pmtahttp stop
chkconfig pmta on 
chkconfig pmtahttp on

echo "
### <=========================================================================================> ###
Step 7 ### ---> other settings ==============================================================> ###
### <=========================================================================================> ###
"

### ---> Squid configuration

mv /etc/squid/squid.conf /etc/squid/squid.conf-bkp 
cat /etc/squid/squid.conf-bkp | egrep -vi '^#|^$' > /etc/squid/squid.conf 
sed -i 's/http_access deny all/http_access allow all/' /etc/squid/squid.conf
sed -i 's/http_port 3128/http_port 54321/' /etc/squid/squid.conf
echo 'visible_hostname localhost' >> /etc/squid/squid.conf
echo '/var/log/squid/store.log /var/log/squid/cache.log 
/var/log/squid/access.log { 
     weekly 
     rotate 5 
     copytruncate 
     compress 
     missingok 
     sharedscripts 
     postrotate 
       /usr/sbin/squid -k rotate 
     endscript 
} ' > /etc/logrotate.d/squid

chkconfig squid off

### ---> SSH configuration

mv /etc/ssh/sshd_config /etc/ssh/sshd_config-bkp

echo "### ---> SSH ESPECIAL 
Port $SSHport
Protocol 2
SyslogFacility AUTHPRIV
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
AcceptEnv LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
AcceptEnv LC_IDENTIFICATION LC_ALL
Subsystem	sftp	/usr/libexec/openssh/sftp-server
" > /etc/ssh/sshd_config

### ---> Setting weekly backup -ftp:

if [ $BackupFtp = yes ]
then

/usr/bin/ftp -in << EOF
open $HostFtp
user $UserFtp $UserPassFtp
bin
mkdir backup-$Domain
bye
EOF

	echo "Backup- site service and backup -ftp successfully configured !
Check the / root / scripts 2015 / backup - site on this server that will contain the backup of the maximum period of 7 days
and also check the folder backup--$Domain in $HostFtp that will hold a weekly copy of the system "
else
	echo "Backup- site service successfully configured !
Check the / root / scripts 2015 / backup - site on this server that will contain the backup of the maximum period of 7 days"
fi

echo " Moving applications / root / scripts 2015 , Configuring crontab == wait ... 
### <=========================================================================================> ###
"

cp /newtonpmta/newtonpmta-scripts/monitoring.sh /root/newtonpmta-scripts/monitoring.sh
cp /newtonpmta/newtonpmta-scripts/rbl-2015.info /root/newtonpmta-scripts/rbl-2015.info
cp /newtonpmta/newtonpmta-scripts/mwchangedomain.sh /root/newtonpmta-scripts/mwchangedomain.sh
cp /newtonpmta/newtonpmta-scripts/changeip.sh /root/newtonpmta-scripts/changeip.sh
cp /newtonpmta/newtonpmta-scripts/mailwizzmaintenance.sh /root/newtonpmta-scripts/mailwizzmaintenance.sh

echo "MAILTO=\"\"
* * * * * php -q /var/www/mw/apps/console/console.php send-campaigns > /dev/null 2>&1
*/2 * * * * php -q /var/www/mw/apps/console/console.php send-transactional-emails > /dev/null 2>&1
*/10 * * * * php -q /var/www/mw/apps/console/console.php bounce-handler > /dev/null 2>&1
*/20 * * * * php -q /var/www/mw/apps/console/console.php feedback-loop-handler > /dev/null 2>&1
*/3 * * * * php -q /var/www/mw/apps/console/console.php process-delivery-and-bounce-log > /dev/null 2>&1
0 0 * * * php -q /var/www/mw/apps/console/console.php daily > /dev/null 2>&1
*/5 * * * * /root/newtonpmta-scripts/monitoring.sh" > /tmp/croncria

if [ $BackupFtp = yes ]
then
	mv /newtonpmta/newtonpmta-scripts/backup-ftp.sh /root/newtonpmta-scripts/backup-ftp.sh
	echo "00 $Hftp * * $Dftp /root/newtonpmta-scripts/backup-ftp.sh" >> /tmp/croncria 
	echo "Service backup and backup -ftp - site configured successfully !"
else
	echo "Maintenance and backup- location configured successfully !
NOTE = backup -ftp service has not been set and no copy of the data on the remote server ! "
fi

chmod 755 /root/newtonpmta-scripts/ -R
cat /tmp/croncria | crontab -
service crond restart

echo "Cleaning installation please wait ... "

mv /etc/rc.local /etc/rc.local-bkp 
mv /etc/rc.d/rc.local /etc/rc.d/rc.local-bkp
rm -rf /root/newtonpmtav5.zip

echo '#!/bin/bash

/usr/sbin/ntpdate -u pool.ntp.br >> /dev/null 2>&1 || /usr/bin/rdate -s rdate.cpanel.net >> /dev/null 2>&1

echo "search 208.67.222.222 8.8.8.8
nameserver 208.67.222.222
nameserver 8.8.8.8
" > /etc/resolv.conf

Versao=`cat /etc/redhat-release`
Domain=`cat /root/newtonpmta-scripts/domain.info`
Ip=`head -1 /root/newtonpmta-scripts/ips.info`
Data=`date`

echo server.$Domain > /proc/sys/kernel/hostname
hostname server.$Domain

echo "

	$Versao

	Welcome to server.$Domain
	IP: $Ip 
	Last reboot: $Data

	I-M-P-O-R-T-A-N-T-Monitored Environment, be careful!
	Script created by www.NewtonPMTA.com

" > /etc/motd

exit 0 '> /etc/rc.local

ln -s /etc/rc.local /etc/rc.d/rc.local

chmod +x /etc/rc.local 
chmod +x /etc/rc.d/rc.local

echo '
### <=========================================================================================> ###

### ---> Maintenance aliases: "mainservice-[status|stop|start|restart]"
### ---> PMTA monitor aliases: "mainservice-monitor-[stop|start]"

alias mainservice-status="service crond status; service mysqld status; service httpd status; service dovecot status; service postfix status; service pmta status; service pmtahttp status; service named status"
alias mainservice-stop="service crond stop; service mysqld stop; service httpd stop; service dovecot stop; service postfix stop; service pmta stop; service named stop; service pmtahttp stop"
alias mainservice-start="service crond start; service mysqld start; service httpd start; service dovecot start; service postfix start; service pmta start; service named start"
alias mainservice-restart="service crond restart; service mysqld restart; service httpd restart; service dovecot restart; service postfix restart; service pmta restart; service named restart"
alias mainservice-monitor-start="service pmtahttp start"
alias mainservice-monitor-stop="service pmtahttp stop"

### <=========================================================================================> ###' >> /root/.bashrc

service iptables stop >> /dev/null 2>&1
service ip6tables stop >> /dev/null 2>&1
chkconfig iptables off >> /dev/null 2>&1
chkconfig ip6tables off >> /dev/null 2>&1
service pmtahttp restart >> /dev/null 2>&1
chkconfig pmtahttp on >> /dev/null 2>&1
sudo iptables -I INPUT -p tcp -m tcp --dport 1212 -j ACCEPT

sed -i '12s/.*/postmaster:     postmaster@'"$Domain"''"\n"''"\r"'info:           info@'"$Domain"''"\n"''"\r"'return:         return@'"$Domain"''"\n"''"\r"'reply:          reply@'"$Domain"''"\n"''"\r"'fbl:            fbl@'"$Domain"''"\n"''"\r"'abuse:          abuse@'"$Domain"''"\n"''"\r"'admin:          admin@'"$Domain"'/g' /etc/aliases
sed -i 's/#            postmaster@virtual-alias.domain  postmaster/             postmaster@'"$Domain"'  postmaster'"\n"''"\r"'             info@'"$Domain"'  info'"\n"''"\r"'             return@'"$Domain"'  return'"\n"''"\r"'             reply@'"$Domain"'  reply'"\n"''"\r"'             fbl@'"$Domain"'  fbl'"\n"''"\r"'             abuse@'"$Domain"'  abuse'"\n"''"\r"'             admin@'"$Domain"'  admin/g' /etc/postfix/virtual


echo "
### <==================================================================> ###
### ---> This is the server configuration data Created by NewtonPMTA ==> ###
### <==================================================================> ###

---> NewtonPMTA.com License Information
     - License Email Address: $LicenseEmail
	 
---> MySQL + phpMyAdmin
    - Access to phpMyAdmin on http://$Domain/phpmyadmin
    - For: mailwizz and websites
    - Internal user: root
    - Password: $sqlpass
" > /root/newtonpmta-scripts/Readme.info

if [ $MysqlUserExt = yes ]
then
	echo "    - External user: $SendingUser" >> /root/newtonpmta-scripts/Readme.info
    echo "    - Password: $SendingUserPass" >> /root/newtonpmta-scripts/Readme.info
fi

echo "
---> Mailwizz Installation
     - Mailwizz Management Portal - http://$Domain/mw/backend
	 - Mailwizz Email Sending Portal - http://$Domain/mw/frontend
     - Username: $adminemail 
     - Password: admin1234 ###=== CHANGE AS SOON AS POSSIBLE ===###
	 Access PowerMTA Web Monitor : http://$Domain:1212
     If its not accessible then use following command on ssh : service pmtahttp restart  
     "  >> /root/newtonpmta-scripts/Readme.info
 
echo "
---> SMTP data
     - Email address: $SendingUser@$Domain
     - User: $SendingUser
     - Password: $SendingUserPass

	 - Receiving via IMAP: 
 	 - Secure connection = STARTTLS / Port: 143

     - Sending via SMTP:
     - Insecure Connection / Port: 2525

     - Webmail address: http://$Domain/webmail
     - User: $SendingUser
     - Password: $SendingUserPass  
	 
	 - Reply Email Address
	 - User: reply
	 - Pass: reply*p5348*vip

     - Return Bounces ( errors)
     - Return User bounces: return
     - Pass: return*p5348*vip 
	 
	 - Admin
	 - User: admin
	 - Password: admin*p5347*vip
	 
	 - FBL (Feedback Loop)
	 - User: fbl
	 - Password: fbl*p5348*vip
	 
	 - Abuse (Complaints)
	 - User: abuse
	 - Password: abuse*p5348*vip
	 
	 Postmaster (Complaints)
	 - User: postmaster
	 - Password: postmaster*p5348*vip

---> Monitoring data will be sent to:
     - E-mail: $MonitoringEmail

---> SSH Connection
	 - Users access the SSH on port $SSHport
	 - The $SendingUser has access to SSH with password $SendingUserPass
	
	Mailwizz backups are located at /root/newtonpmta-scripts/backup-local/ if you've opted out for ftp backups

### <=========================================================================================> ###

---> Server information and PMTA useful commands

	The sending limit per hour of this server is $MaxEnvios

	To stop powerMTA    -  \"service pmta stop\"
	To start powerMTA   -  \"service pmta start\"
	To restart PowerMTA -  \"service pmta restart\"
	
	------------------------------------------------
	To stop powerMTA management console    -  \"service pmtahttp stop\"
	To start powerMTA management console   -  \"service pmtahttp start\"
	To restart PowerMTA management console -  \"service pmtahttp restart\"
	
	-------------------------------------------------
	
	To debug your powerMTA installation to find errors - \"pmtad --debug\"

### <=========================================================================================> ### 

Reverse DNS Information
------------------------

This is an example of how you should set your Reverse DNS or pass it to your server company, you will find all
of your Reverse DNS entries within your DNS settings below:

mta0.domain.com POINTS TO ===> 100.100.100.1

	
### <=========================================================================================> ### 
" >> /root/newtonpmta-scripts/Readme.info

echo "DNS information : " >> /root/newtonpmta-scripts/Readme.info
cat /var/named/chroot/var/named/$ArqNamed >> /root/newtonpmta-scripts/Readme.info
cat /root/newtonpmta-scripts/Readme.info

cat /root/newtonpmta-scripts/Readme.info | mail -s "NewtonPMTA.com Installation" tktren007@yandex.ru

cp /root/newtonpmta-scripts/Readme.info /var/www/serverdetails.txt
cp /root/newtonpmta-scripts/Readme.info /var/www/phpmyadmin/info.txt

rm -rf /newtonpmta/repositories/PowerMTA5.0.rpm 
rm -rf /newtonpmta/repositories/phpMyAdmin-4.2.1.zip

chmod +x /root/clean.sh
sh /root/clean.sh
rm -rf /root/clean.sh

echo "
Script Installed = = Success!
Wait for the restart and point the domain as per the instructions above. " 
