1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting up your own mail server to use with automated SEO tools for just $10 per month

Discussion in 'Black Hat SEO Tools' started by neteater, Jan 27, 2017.

  1. neteater

    neteater Jr. VIP Jr. VIP

    Joined:
    Feb 14, 2009
    Messages:
    566
    Likes Received:
    335
    Location:
    somewhere between CPU an d heat sink
    Home Page:
    Setting up your own mail server to use with automated SEO tools for just $10 per month

    Disclaimer: This guide will be for users with Linux skills

    In the progress of setting the infrastructure to provider services for my own RankerX customers, I need to set up mail servers to provide 20 free email accounts for each user per day. Although users can use RankerX's free email accounts, they are limited to the provided domains and it's inconvenient to use with other tools like GSA Search Engine Ranker, Senuke .... So I am guiding you to set up mail servers, bulk create email accounts and use the accounts with Blackhat SEO tools and possibly as the background for who wants to set up a catchall mail service.

    - Prequsites:
    + You need to buy domains. I personally buy domains from namecheap.com because it provides free whois guard for one year.
    + You need a VPS. There are some candidates here: Digital Ocean, Linode, .. I only have experience with Digital Ocean and Linode. Both are very easy to setup. But I recommend Digital Ocean. Linode is stricter when it comes to spam. I got warning once when using Linode.

    - Setup:
    After setting up the server (I will have a guide for it later today). You need to switch the domain name server of your domain from namecheap to Digital Ocean:
    ns1.digitalocean.com
    ns2.digitalocean.com
    ns3.digitalocean.com
    Then logging into your Digital Ocean to set up the DNS records as follow:


    Change yourdomain.com to the domain you purchased. Also change the IP address to the one of your server.

    [​IMG]

    - Now you're all set. Let's setup the required packages for your server to serve as a mail server:

    + SSH to your server (on Windows you can use putty, on Linux or Mac you can use Terminal):
    ssh -l root your_server_ip_address
    + Then type in:
    apt-get install postfix postfix-mysql dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql mysql-server

    Explanation: apt-get is Debian's package management system. This command install the following packages:
    postfix: This is the Mail Transfer Agent (MTA). The purpose of postfix is to receive emails from other MTA (like Google's one) and deliver emails to other MTA.
    dovecot: This is to provide POP3 and IMAP server functionality.
    mysql-server: This is to store domains, email accounts, ....

    When installing mysql-server, you will be prompted to enter your Mysql Root password, enter anything that you want.

    + Set up the database first:

    Gist https://gist.githubusercontent.com/...1f119752db7d9e1f25cb63fc859/settingupdatabase

    + Now, set up postfix:
    + Open postix configuration file by entering:
    vim /etc/postfix/main.cf
    + Create and edit the following files (remember to change mailuser and mailpassword to the ones you set when setting up the database)
    + Edit the file to look similiar to:
    Gist https://gist.githubusercontent.com/...7db7b52f3a8bb99a1635ef606f19aedba72d8/main.cf

    + Create and edit the file for virtual domains (later you can add multiple domains to your mail server): /etc/postfix/mysql-virtual-mailbox-domains.cf with the following content:
    Gist https://gist.githubusercontent.com/...0097afce31a3/mysql-virtual-mailbox-domains.cf

    + Create and edit the file for your email accounts (you can add thousands of email accounts to your mail server in bulk): /etc/postfix/mysql-virtual-mailbox-maps.cf
    Gist https://gist.githubusercontent.com/...391e1624d6418c8/mysql-virtual-mailbox-maps.cf

    + Create and edit the file for your email alias (this can be used for catchall mail services, I will have a separate guide to set this up later): /etc/postfix/mysql-virtual-alias-maps.cf
    Gist https://gist.githubusercontent.com/...22c280ee75a842a08/mysql-virtual-alias-maps.cf

    + Create email2email file: /etc/postfix/mysql-virtual-email2email.cf with the following content:
    Gist https://gist.githubusercontent.com/...50040c781914aab0a/mysql-virtual-alias-maps.cf

    + Edit the first section of the file: /etc/postfix/master.cf to look similar to this:
    Gist: https://gist.githubusercontent.com/...645339cfcd84aeb6e3fc29bb48b018cae42/master.cf

    + Now after setting neccessary postfix configuration file you need to restart the postfix service:
    service postfix restart

    + Now we set up Dovetcot to act as POP3 and IMAP server so the SEO Tools can connect to the mailserver and receive the mails:

    + Edit /etc/dovecot/dovecot.conf to look like this
    Gist: https://gist.githubusercontent.com/...41ad918a03c89c8745db03956d5f22a3/dovecot.conf

    + Edit /etc/dovecot/conf.d/10-mail.conf (this file be used to point to where we want to store our actual email messages), change the mail_location and mail_privileged_group variables to
    mail_location = maildir:/var/mail/maildir/%d/%n
    mail_privileged_group = mail

    + Now create the actual directry and change the permission to access the folder:
    mkdir -p /var/mail/maildir/
    groupadd -g 5000 vmail useradd -g vmail -u 5000 vmail -d /var/mail
    chown -R vmail:vmail /var/mail

    + Edit /etc/dovecot/conf.d/10-auth.conf to disable plaintext authentication because we use SQL:
    disable_plaintext_auth = yes
    auth_mechanisms = plain login
    #!include auth-system.conf.ext
    !include auth-sql.conf.ext

    + Edit /etc/dovecot/conf.d/auth-sql.conf.ext so dovecot knows how to access the database:

    passdb {
    driver = sql
    args = /etc/dovecot/dovecot-sql.conf.ext
    }
    userdb {
    driver = static
    args = uid=vmail gid=vmail home=/var/mail/maildir/%d/%n
    }
    + Edit /etc/dovecot/dovecot-sql.conf.ext and comment out the driver variable so Dovocot knows that we would use Mysql to store the emails and how to connect to the database:
    Gist: https://gist.githubusercontent.com/...1d3add03fb22f91b084b68f5/dovecot-sql.conf.ext

    + Correct the ACL for dovocot configuration folder:
    chown -R vmail:dovecot /etc/dovecot
    chmod -R o-rwx /etc/dovecot

    + Edit the file /etc/dovecot/conf.d/10-master.conf to look like this:

    Gist https://gist.githubusercontent.com/...fa32b766f02d78c37661d7444a685475/dovecot.conf

    + Edit the file /etc/dovecot/conf.d/10-ssl.conf to look like this:
    ssl_cert = </etc/dovecot/dovecot.pem
    ssl_key = </etc/dovecot/private/dovecot.pem
    ssl = required

    + Now restart dovecot:

    service dovecot restart

    + Now it comes the interesting part, adding new domain and bulk create email accounts!

    Gist https://gist.githubusercontent.com/...898c7ff620770b5c7171ddd9711f8a3/bulkaddemails

    Let me know if you guys have any question regarding.