Friday, December 31, 2021

Git Configuration and Commit Command

Git Configuration :


git config --global user.email "you@example.com"

git config --global user.name "Your Name"


Commit comman for Mac:

git reset --mixed origin/main 
git add * 
git commit -m "This is a new commit for what I originally planned to be amended" 
git push origin main

Commit comman for Windows:


git add * or git add --all
git commit -m"first message"
git remote add origin "LINK"
git push -u origin master

Tuesday, December 28, 2021

Track from where method is being called in codeigniter


For example, suppose your function name is test, use below code
Code:

function test( )
{
$backtrace = debug_backtrace();

print_r( $backtrace );
}
It will print the details from where the test method is being called.

How to Allow WebP Upload in WordPress using Function

//enable upload for webp image files.

function webp_upload_mimes($existing_mimes) {

    $existing_mimes['webp'] = 'image/webp';

    return $existing_mimes;

}

add_filter('mime_types', 'webp_upload_mimes');


//enable preview / thumbnail for webp image files.

function webp_is_displayable($result, $path) {

    if ($result === false) {

        $displayable_image_types = array( IMAGETYPE_WEBP );

        $info = @getimagesize( $path );


        if (empty($info)) {

            $result = false;

        } elseif (!in_array($info[2], $displayable_image_types)) {

            $result = false;

        } else {

            $result = true;

        }

    }


    return $result;

}

add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);

function webp_upload_mimes($existing_mimes) {
    $existing_mimes['webp'] = 'image/webp';
    return $existing_mimes;
}
add_filter('mime_types', 'webp_upload_mimes');

//enable preview / thumbnail for webp image files.
function webp_is_displayable($result, $path) {
    if ($result === false) {
        $displayable_image_types = array( IMAGETYPE_WEBP );
        $info = @getimagesize( $path );

        if (empty($info)) {
            $result = false;
        } elseif (!in_array($info[2], $displayable_image_types)) {
            $result = false;
        } else {
            $result = true;
        }
    }

    return $result;
}
add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);

Tuesday, November 23, 2021

How to use Siteground SSH in MacOS terminal

On Siteground the steps are as follows:
Logon to your account at Siteground.
Open Site Tools for your website.
Go to Devs = SSH Keys Manager.
Enter a Key name (e.g. privatekey)
Generate a Password
Click the Create button.
Go to3dots=Manage IP access to limit the IP addresses that can use this connection.
Go to3dots= Private Key and copy it to your clipboard.
On your local machine, open your preferred Terminal
Browse to /path/to/your/privatekey
Create new file, call it myschool and paste the Private key.
Run the following commands
chmod 600 privatekey
ssh-add privatekey
Back in the Site Tools = SSH Keys Manager, go to3dots= SSH Credentials to discover the username and hostname to use.
Now you can run the following command, in order to gain SSH access

ssh username@privatekey -p12345

Wednesday, November 17, 2021

How to install Composer in MacOS

Install download the composer using the following curl command in the terminal:
curl -sS https://getcomposer.org/installer | php
 
After the command, you will have composer.phar file in the current directory and the composer command is available as: 

 php composer.phar [composer commnad] 

In order to make composer available globally, you have to move the recently downloaded composer.phar to local user’s bin folder as follow: 

sudo mv composer.phar /usr/local/bin/

 go to /usr/local/bin folder . 
You can click Shift + Command + G to open the dialog to go to folder. move the recently downloaded composer.phar in the usr/local/bin folder. 

We want to run Composer with having to be root al the time, so we need to change the permissions:
 sudo chmod 755 /usr/local/bin/composer.phar
create a alias using command:

Next, we need to let Bash know where to execute Composer:

 nano ~/.bash_profile
Add this line below to bash_profile and save
alias composer="php /usr/local/bin/composer.phar"
and then run this command:

 source ~/.bash_profile

Finally, run: composer --version

Now, you can access the composer from the terminal simply using the composer command.




Install PhpStorm on Mac OSX

About the App
Install the App
  1. Press Command+Space and type Terminal and press enter/return key.
  2. Run in Terminal app:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2> /dev/null
    and press enter/return key. If you are prompted to enter your Mac's user password, enter it (when you type it, you wont see it on your screen/terminal.app but it would accept the input; this is to ensure no one can see your password on your screen while you type it. So just type password and press enter, even if you dont see it on your screen). Then wait for the command to finish.
  3. Run:
    brew install phpstorm

    Done!

    You can now use PhpStorm.

Sunday, November 7, 2021

PowerMTA Multiple Virtual PMTA Custom config file (version PowerMTA-5.0r1)

 ############################################################################

# BEGIN: BACKOFF RULES


#N: ISP rules

############################################################################

# domains that resolve to mx?.hotmail.com

domain-macro hotmail hotmail.com,msn.com,hotmail.co.uk,hotmail.fr,live.com,hotmail.it,hotmail.de,email.msn.com,email.hotmail.com,email.msn.com,hotmail.com,live.com,msn.com,webtv.com,webtv.net

<domain $hotmail>

    max-smtp-out 1 # prevent "exceeded the connection limit"

    max-msg-rate 250/h # prevent "exceeded the rate limit"

</domain>


# domains that resolve to ?.mx.mail.yahoo.com

domain-macro yahoo yahoo.com,yahoo.ca,rocketmail.com,ymail.com,yahoo.com.au,geocities.com,yahoo.com.mx,yahoo.com.br,altavista.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


<domain $yahoo>

    max-msg-per-connection 2 # yahoo policy

    max-msg-rate 250/h # prevent "exceeded the rate limit"

</domain>


# domains that resolve to mailin-0?.mx.aol.com

domain-macro aol aol.com,aim.com,aim.net,cs.com,netscape.com,wmconnect.net,netscape.net,cs.com,mail.com,wmconnect.com,icqmail.com,email.com,usa.com

<domain $aol>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

</domain>


# domains that resolve to (alt?.)gmail-smtp-in.l.google.com

domain-macro gmail gmail.com,googlemail.com

<domain $gmail>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

</domain>

# http://feedback.comcast.net/

 <domain comcast.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>

# Ameritrade, Amitrade

 <domain tdameritrade.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Ameritrade, Amitrade

 <domain ameritrade.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>

 # Broadband

 <domain charterinternet.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Broadband

 <domain comcast.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Broadband

 <domain comcast.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>



# Broadband

 <domain comcastwork.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Broadband

 <domain cox.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Broadband

 <domain cox.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Broadband

 <domain coxinternet.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Broadband

 <domain cox-internet.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Broadband

 <domain suddenlink.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>

# Broadband

 <domain windjammer.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain centurylink.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain centurylink.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain centurytel.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain centurytel.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain cswnet.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain emadisonriver.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain emadisonriver.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain embarq.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain embarq.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain embarqmail.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain grics.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain gulftel.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain mebtel.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain qwest.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain uswest.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain uswest.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain swestmail.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Century Link

 <domain uswestmail.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Cincinnati Bell

 <domain fuse.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Cincinnati Bell

 <domain fuse.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Cincinnati Bell

 <domain zoomnet.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Cincinnati Bell

 <domain zoomtown.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Cincinnati Bell

 <domain zoomtown.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Earthlink

 <domain earthlink.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Earthlink

 <domain earthlink.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Earthlink

 <domain mindspring.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Earthlink

 <domain netcom.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Godaddy

 <domain Inbox.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Godaddy

 <domain outblaze.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Iwon

 <domain excite.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Iwon

 <domain iwon.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Lycos

 <domain angelfire.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Lycos

 <domain lycos.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Lycos

 <domain lycosmail.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Lycos

 <domain mailcity.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Sprint

 <domain sprintpcs.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Time Warner

 <domain rr.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Time Warner

 <domain adelphia.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Time Warner

 <domain adelphia.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Time Warner

 <domain insightbb.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Time Warner

 <domain roadrunner.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Time Warner

 <domain roadrunner.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# Tmobile

 <domain tmomail.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# United Internet

 <domain gmx.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# United Internet

 <domain mail.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# United Online

 <domain juno.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# United Online

 <domain netzero.com>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# United Online

 <domain unitedonline.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


# United XO

 <domain concentric.net>

    max-msg-rate 250/h # prevent "exceeded the rate limit"

 </domain>


 <domain *>

        use-starttls yes

        require-starttls no

 </domain>

############################################################################

# BEGIN: BACKOFF RULES

#<pattern-list myList>

#mail-from /admin@nicholashillmail.com/ virtual-mta=pmta-vmta19

#header from /admin@nicholashillmail.com/ virtual-mta=pmta-vmta19

#mail-from /admin@mx2.nicholashill.eu/ virtual-mta=pmta-vmta3

#header from /admin@mx2.nicholashill.eu/ virtual-mta=pmta-vmta3

#mail-from /admin@mx3.nicholashill.eu/ virtual-mta=pmta-vmta4

#header from /admin@mx3.nicholashill.eu/ virtual-mta=pmta-vmta4

#mail-from /admin@mx4.nicholashill.eu/ virtual-mta=pmta-vmta5

#header from /admin@mx4.nicholashill.eu/ virtual-mta=pmta-vmta5

#mail-from /admin@mx5.nicholashill.eu/ virtual-mta=pmta-vmta6

#header from /admin@mx5.nicholashill.eu/ virtual-mta=pmta-vmta6

#mail-from /admin@mx6.nicholashillmail.com/ virtual-mta=pmta-vmta7

#header from /admin@mx6.nicholashillmail.com/ virtual-mta=pmta-vmta7

#mail-from /admin@mx5.nicholashillmail.com/ virtual-mta=pmta-vmta8

#header from /admin@mx5.nicholashillmail.com/ virtual-mta=pmta-vmta8

#mail-from /admin@mx4.nicholashillmail.com/ virtual-mta=pmta-vmta9

#header from /admin@mx4.nicholashillmail.com/ virtual-mta=pmta-vmta9

#mail-from /admin@mx3.nicholashillmail.com/ virtual-mta=pmta-vmta10

#header from /admin@mx3.nicholashillmail.com/ virtual-mta=pmta-vmta10

#mail-from /admin@mx2.nicholashillmail.com/ virtual-mta=pmta-vmta11

#header from /admin@mx2.nicholashillmail.com/ virtual-mta=pmta-vmta11

#mail-from /admin@mx1.nicholashillmail.com/ virtual-mta=pmta-vmta12

#header from /admin@mx1.nicholashillmail.com/ virtual-mta=pmta-vmta12

#mail-from /admin@mx5.nicholashillnews.com/ virtual-mta=pmta-vmta13

#header from /admin@mx5.nicholashillnews.com/ virtual-mta=pmta-vmta13

#mail-from /admin@mx4.nicholashillnews.com/ virtual-mta=pmta-vmta14

#header from /admin@mx4.nicholashillnews.com/ virtual-mta=pmta-vmta14

#mail-from /admin@mx3.nicholashillnews.com/ virtual-mta=pmta-vmta15

#header from /admin@mx3.nicholashillnews.com/ virtual-mta=pmta-vmta15

#mail-from /admin@mx2.nicholashillnews.com/ virtual-mta=pmta-vmta16

#header from /admin@mx2.nicholashillnews.com/ virtual-mta=pmta-vmta16

#mail-from /admin@mx1.nicholashillnews.com/ virtual-mta=pmta-vmta17

#header from /admin@mx1.nicholashillnews.com/ virtual-mta=pmta-vmta17

#mail-from /admin@nicholashillnews.com/ virtual-mta=pmta-vmta18

#header from /admin@nicholashillnews.com/ virtual-mta=pmta-vmta18

#mail-from /admin@nicholashill.eu/ virtual-mta=pmta-vmta1

#header from /admin@nicholashill.eu/ virtual-mta=pmta-vmta1

#mail-from /admin@mx1.nicholashill.eu/ virtual-mta=pmta-vmta2

#header from /admin@mx1.nicholashill.eu/ virtual-mta=pmta-vmta2

#</pattern-list>



#<source 127.0.0.1>

#pattern-list myList # this selects the pattern list for messages

#always-allow-relaying yes

#</source>


#<pattern-list myList>

#header from /admin@mx3.nicholashillmail.com/ virtual-mta=pmta-vmta10

#mail-from /admin@mx3.nicholashillmail.com/ virtual-mta=pmta-vmta10

#header from /admin@mx4.nicholashillmail.com/ virtual-mta=pmta-vmta9

#mail-from /admin@mx4.nicholashillmail.com/ virtual-mta=pmta-vmta9

#</pattern-list>

#<source 127.0.0.1>

#pattern-list myList # this selects the pattern list for messages

#</source>


# default domain settings

<domain *>

    max-smtp-out 2 # default be nice on concurrent connections

    max-msg-per-connection 100 # max 500 mails in one session

    max-errors-per-connection 10 # avoid 'too long without data command' error

    max-msg-rate 1000/h

    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 24h # 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-notify "" # disable backoff notifications

    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)

    dk-sign yes

    dkim-sign yes

</domain>


############################################################################

# END: ISP 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>

    #

    # A QUEUE IN BACKOFF MODE WILL SEND MORE SLOWLY

    # To place a queue back into normal mode, a command similar

    # to one of the following will need to be run:

    # pmta set queue --mode=normal yahoo.com

    # or

    # pmta set queue --mode=normal yahoo.com/vmta1

    #

    # To use backoff mode, uncomment individual <domain> directives

    #

    #AOL 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

    #

    #Yahoo Errors

    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

    #

    # The following 4 Yahoo errors may be very common

    # Using them may result in high use of backoff mode

    #

    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

    #

    #Hotmail Errors

    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

    #

    #Adelphia Errors

    reply /421 Message Rejected/ mode=backoff

    reply /Client host rejected/ mode=backoff

    reply /blocked using UCEProtect/ mode=backoff

    #

    #Road Runner Errors

    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

    #

    #General Errors

    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  # hotmail rate limit

  reply /421rlynw/ mode=backoff  # aol rate limit

  reply /permanently deferred/ mode=backoff  # yahoo

  reply /\d+\.\d+\.\d+\.\d+ blocked/ mode=backoff  # at&t, cox

  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

    /sender ((verify|verification) failed|could not be verified|address rejected|domain must exist)/ invalid-sender

    /unable to verify sender/ invalid-sender

    /requires valid sender domain/ invalid-sender

    /bad sender's system address/ invalid-sender

    /No MX for envelope sender domain/ invalid-sender

    /^[45]\.4\.4/ routing-errors

    /no mail hosts for domain/ invalid-sender

    /Your domain has no(t)? DNS\/MX entries/ invalid-sender

    /REQUESTED ACTION NOT TAKEN: DNS FAILURE/ invalid-sender

    /Domain of sender address/ invalid-sender

    /return MX does not exist/ invalid-sender

    /Invalid sender domain/ invalid-sender

    /Verification failed/ invalid-sender

    /\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

    /refused/ policy-related

    /allowed/ policy-related

    /banned/ policy-related

    /policy/ policy-related

    /suspicious activity/ policy-related

    /bad sequence/ protocol-errors

    /syntax error/ protocol-errors

    /\bsmtp-hosts\b/ routing-errors

    /\bunroutable\b/ routing-errors

    /\bunsmtp-hostsable\b/ routing-errors

#additions by krish

    /Recipient address rejected/ invalid-mailbox

    /DYN:T1/ ploicy-related

    /Service unavailable/ ploicy-related

    /DNSBL/ spam-related

    /ccount has been disabled or discontinued/ bad-mailbox

    /oo many recip/ policy-related

    /no valid recipie/ invalid-mailbox

    /Account Inactive/ invalid-mailbox

    /service provider since part of their network is on our block list/ spam-related


    /Invalid 7bit DATA/ content-related

    /^2.\d+.\d+;/ success

    /^[45]\.1\.[1346];/ bad-mailbox

    /^[45]\.1\.2/ bad-domain

    /^[45]\.1\.[78];/ invalid-sender

    /^[45]\.2\.0;/ bad-mailbox

    /^[45]\.2\.1;/ inactive-mailbox

    /^[45]\.2\.2;/ quota-issues

    /^[45]\.3\.3;/ content-related

    /^[45]\.3\.5;/ bad-configuration

    /^[45]\.4\.1;/ no-answer-from-host

    /^[45]\.4\.2;/ bad-connection

    /^[45]\.4\.[36];/ routing-errors

    /^[45]\.4\.7;/ message-expired

    /^[45]\.5\.3;/ policy-related

    /^[45]\.5\.\d+;/ protocol-errors

    /^[45]\.6\.\d+;/ content-related

    /^[45]\.7\.[012];/ policy-related

    /^[45]\.7\.7;/ content-related

    // other    # catch-all

</bounce-category-patterns>



############################################################################

# END: BOUNCE RULES

############################################################################






############################################################################

# BEGIN: OTHER OPTIONS

############################################################################


#smtp-port 2525

<source 0/0>

log-connections yes

log-commands    yes      # WARNING: verbose!

  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


http-mgmt-port 1983

http-access 127.0.0.1 admin

http-access 0/0 monitor

http-access 176.283.454.55 admin


############################################################################

# END: OTHER OPTIONS

############################################################################


################################################ ############################

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

################################################ ############################

#<spool /var/spool/pmta>

#</spool>

<smtp-user user>

password passwd

source {smtpuser-auth}

</smtp-user>

<source {smtpuser-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

</source>


smtp-listener 176.283.454.55:2525


#BEGIN VIRTUAL MTAS 

<virtual-mta pmta-vmta1> 

smtp-source-host 176.283.454.55 mta1.domain.com 

domain-key mailer,*,/etc/pmta.key 

#domain-key default,*,/var/cpanel/domain_keys/private/domain.com 

<domain *> 

max-msg-rate 400/h 

</domain> 

</virtual-mta> <domain domain.com> 

smtp-hosts [127.0.0.1]:2525 

</domain> 

#END VIRTUAL MTAS



<virtual-mta-pool pmta-pool>

#virtual-mta pmta-vmta1

</virtual-mta-pool>

################################################ ############################

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

################################################ ############################

<source 127.0.0.1>

    always-allow-api-submission yes

    add-message-id-header yes

    retain-x-job yes

    retain-x-virtual-mta yes

    verp-default yes

    process-x-envid yes

    process-x-job yes

    jobid-header X-Mailer-RecptId

    process-x-virtual-mta yes

</source>


#<domain *>

#smtp-hosts [127.0.0.1]:2525

#</domain>


PowerMTA Multiple Virtual PMTA config file

# $Id: config 2015-03-24 16:00:00 Jack $
# Sample PowerMTA configuration file
# PowerMTA Multiple Virtual PMTA config file sample

#
# E-mail address for mailer's administrator (please specify!)
#
postmaster admin@mydomain.com
domain-key my-domain,*,/etc/dkim.key

#
# Settings per source IP address (for incoming SMTP connections)
#
<source 127.0.0.1>
always-allow-relaying yes # allow feeding from 127.0.0.1
process-x-virtual-mta yes # allow selection of a virtual MTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
allow-mailmerge yes
</source>

<source 23.45.67.100> # phplist or oempro installed
always-allow-relaying yes # allow feeding from mailer.mydomain.com
process-x-virtual-mta yes # allow selection of a virtual MTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
hide-message-source true
remove-header Received
allow-mailmerge yes
</source>

<source 102.202.33.2>
always-allow-relaying yes # allow feeding from 102.202.33.2
process-x-virtual-mta yes # allow selection of a virtual MTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
hide-message-source true
remove-header Received
</source>

<source 102.202.33.3>
always-allow-relaying yes # allow feeding from 102.202.33.3
process-x-virtual-mta yes # allow selection of a virtual MTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
hide-message-source true
remove-header Received
</source>

<source 102.202.33.4>
always-allow-relaying yes # allow feeding from 102.202.33.4
process-x-virtual-mta yes # allow selection of a virtual MTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
hide-message-source true
remove-header Received
</source>

<source 102.202.33.5>
always-allow-relaying yes # allow feeding from 102.202.33.5
process-x-virtual-mta yes # allow selection of a virtual MTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
hide-message-source true
remove-header Received
</source>

<source 102.202.33.6>
always-allow-relaying yes # allow feeding from 102.202.33.6
process-x-virtual-mta yes # allow selection of a virtual MTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
hide-message-source true
remove-header Received
</source>

<source 0/0> # matches all
log-connections no
log-commands no # WARNING: verbose!
log-data no # WARNING: even more verbose!
allow-unencrypted-plain-auth no
default-virtual-mta mta-pool
process-x-virtual-mta yes
smtp-service yes
always-allow-api-submission yes
</source>

<virtual-mta mta1>
auto-cold-virtual-mta 23.45.68.200 mpta.mydomain.com # MPTA installed
<domain *>
max-cold-virtual-mta-msg 100/day
</domain>
smtp-source-host 23.45.68.200 mpta.mydomain.com # MPTA installed
</virtual-mta>

<virtual-mta mta2>
auto-cold-virtual-mta 102.202.33.2 name2.newdomain.com # config multiple domains/IPs
domain-key edm-mail,*,/etc/dkim.key
<domain *>
max-cold-virtual-mta-msg 100/day
dkim-sign yes
dkim-identity @mydomain.com
</domain>
smtp-source-host 102.202.33.2 name2.newdomain.com
</virtual-mta>

<virtual-mta mta3>
auto-cold-virtual-mta 102.202.33.3 name3.newdomain.com # config multiple domains/IPs
domain-key edm-mail,*,/etc/dkim.key
<domain *>
max-cold-virtual-mta-msg 100/day
dkim-sign yes
dkim-identity @mydomain.com
</domain>
smtp-source-host 102.202.33.3 name3.newdomain.com
</virtual-mta>

<virtual-mta mta4>
auto-cold-virtual-mta 102.202.33.4 name4.newdomain.com # config multiple domains/IPs
domain-key edm-mail,*,/etc/dkim.key
<domain *>
max-cold-virtual-mta-msg 100/day
dkim-sign yes
dkim-identity @mydomain.com
</domain>
smtp-source-host 102.202.33.4 name4.newdomain.com
</virtual-mta>

<virtual-mta mta5>
auto-cold-virtual-mta 102.202.33.5 name5.newdomain.com # config multiple domains/IPs
domain-key edm-mail,*,/etc/dkim.key
<domain *>
max-cold-virtual-mta-msg 100/day
dkim-sign yes
dkim-identity @mydomain.com
</domain>
smtp-source-host 102.202.33.5 name5.newdomain.com
</virtual-mta>

<virtual-mta mta6>
auto-cold-virtual-mta 102.202.33.6 name6.newdomain.com # config multiple domains/IPs
domain-key edm-mail,*,/etc/dkim.key
<domain *>
max-cold-virtual-mta-msg 100/day
dkim-sign yes
dkim-identity @mydomain.com
</domain>
smtp-source-host 102.202.33.6 name6.newdomain.com
</virtual-mta>


<virtual-mta-pool mta-pool>
virtual-mta mta2
virtual-mta mta3
virtual-mta mta4
virtual-mta mta5
virtual-mta mta6
</virtual-mta-pool>

#
# SMTP users (authenticated via SMTP AUTH)
#
#<smtp-user API>
# password "changeme"
#</smtp-user>

<smtp-user user1>
password R45eoDwZ
source {auth}
</smtp-user>
<smtp-user user2>
password R45eoDwZ
source {auth}
</smtp-user>

<source {auth}>
always-allow-relaying yes # allow feeding for defined users
process-x-virtual-mta yes # allow selection of a VirtualMTA
max-message-size 0 # 0 implies no cap, in bytes
smtp-service yes # allow SMTP service
require-auth true
default-virtual-mta mta-pool
</source>

#
# Settings per outgoing domain
#
#<domain discard.port25.com>
# max-smtp-out 800
# route [192.168.0.1]:2525 # bypasses DNS resolution
#</domain>
#
#<domain test.port25.com>
# max-smtp-out 1
# log-connections yes
# log-commands yes # WARNING: verbose!
# log-resolution no # WARNING: verbose!
# log-data no # WARNING: even more verbose!
#</domain>

#
# "{gmImprinter}" is a special queue used for imprinting Goodmail tokens.
#
<domain {gmImprinter}>
max-events-recorded 150
log-messages yes
log-data no # extremely verbose, for debugging only
retry-after 15s
</domain>

<domain *>
max-smtp-out 2 # max. connections *per domain*
bounce-after 4d12h # 4 days, 12 hours
retry-after 60m # 10 minutes
max-msg-rate 100/h
max-msg-per-connection 20
max-errors-per-connection 10
smtp-greeting-timeout 1m # added in v3.2r17
bounce-upon-no-mx yes
mx-connection-attempts 3 # added in v3.2r16
smtp-pattern-list backoff
backoff-to-normal-after 2h # added in v3.5
backoff-max-msg-rate 50/h # Use with PowerMTA 3.5
backoff-retry-after 90m
dk-sign yes
dkim-sign yes
</domain>

#
# Goodmail imprinter configuration
#
#<gm-imprinter>
# account-id ID # replace with value from mailcenter
# imprinter-id ID # replace with value from mailcenter
# imprinter-password PW # replace with value from mailcenter
#
# # If the directives below are not specified, defaults are picked as
# # described in the Goodmail documentation
#
# default-token-class 1 # optionally set as appropriate
# default-content-type 1 # optionally set as appropriate
# default-payer-id ID # optionally set as appropriate
# default-obo-id ID # optionally set as appropriate
#</gm-imprinter>


#
# Port used for HTTP management interface
#
http-mgmt-port 8080

#
# IP addresses allowed to access the HTTP management interface, one
# per line
#
http-access 127.0.0.1 monitor
#http-access 10.1.0.10 none
#http-access 10.1.0/24 admin
http-access 21.34.56.78 admin


#
# Synchronize I/O to disk after receiving the message. 'false' yields
# higher performance, but the message may be lost if the system crashes
# before it can write the data to disk.
#
sync-msg-create false

#
# Synchronize I/O to disk after updating the message (e.g., to mark recipients
# handled). 'false' yields higher performance, but if the system crashes
# before it can write the data to disk, some recipients may receive multiple
# copies of a message.
#
sync-msg-update false

#
# Whether to run the PowerMTA deamon as root
#
run-as-root no

#
# WARNING -- changing the settings below will probably break
# RPM installation, logrotate, etc.

#
# Logging file name
#
log-file /var/log/pmta/log # logrotate is used for rotation

#
# Accounting file(s)
#
<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>

#
# Spool directories
#
spool /var/spool/pmta

# EOF

<smtp-pattern-list backoff>
#
# A QUEUE IN BACKOFF MODE WILL SEND MORE SLOWLY
# To place a queue back into normal mode, a command similar
# to one of the following will need to be run:
# pmta set queue mode=normal yahoo.com
# or
# pmta set queue mode=normal yahoo.com/vmta1
#
# To use backoff mode, uncomment individual <domain> directives
#
#Yahoo Errors
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
#
# The following 4 Yahoo errors may be very common
# Using them may result in high use of backoff mode
#
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
#
#Hotmail Errors
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
#
#Adelphia Errors
reply /421 Message Rejected/ mode=backoff
reply /Client host rejected/ mode=backoff
reply /blocked using UCEProtect/ mode=backoff
#
#Road Runner Errors
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
#
#General Errors
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 /421 *connection limit exceeded/ 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
</smtp-pattern-list>

#
# http://postmaster.info.aol.com/
<domain aol.com>
max-smtp-out 3
max-msg-per-connection 20
smtp-pattern-list backoff
421-means-mx-unavailable yes
backoff-to-normal-after 4h # added in v3.5
# backoff-notify admin@mydomain.com
backoff-max-msg-rate 20/h # Use with PowerMTA 3.5
backoff-retry-after 120m
dk-sign yes
dkim-sign yes
</domain>
#
<domain tom.com>
max-smtp-out 3
max-msg-per-connection 20
smtp-pattern-list backoff
421-means-mx-unavailable yes
backoff-to-normal-after 2h # added in v3.5
backoff-max-msg-rate 20/h # Use with PowerMTA 3.5
backoff-retry-after 120m
# backoff-notify admin@mydomain.com
dk-sign yes
dkim-sign yes
</domain>
#
<domain yahoo.com>
max-smtp-out 3
max-msg-per-connection 20
smtp-greeting-timeout 1m # added in v3.2r17
mx-connection-attempts 5 # added in v3.2r16
smtp-pattern-list backoff
backoff-to-normal-after 2h # added in v3.5
backoff-max-msg-rate 50/h # Use with PowerMTA 3.5
backoff-retry-after 90m
# backoff-notify admin@mydomain.com
dk-sign yes
dkim-sign yes
</domain>
#
<domain gmail.com>
max-smtp-out 3
max-msg-per-connection 50
smtp-greeting-timeout 1m # added in v3.2r17
mx-connection-attempts 5 # added in v3.2r16
smtp-pattern-list backoff
backoff-to-normal-after 2h # added in v3.5
backoff-max-msg-rate 50/h # Use with PowerMTA 3.5
backoff-retry-after 90m
# backoff-notify admin@mydomain.com
dk-sign yes
dkim-sign yes
</domain>
#
<domain hotmail.com>
max-smtp-out 3
max-msg-per-connection 50
421-means-mx-unavailable yes
smtp-pattern-list backoff
backoff-to-normal-after 2h # added in v3.5
backoff-max-msg-rate 50/h # Use with PowerMTA 3.5
backoff-retry-after 90m
# backoff-notify admin@mydomain.com
dk-sign yes
dkim-sign yes
</domain>
#
<domain msn.com>
max-smtp-out 3
max-msg-per-connection 50
smtp-pattern-list backoff
backoff-to-normal-after 2h # added in v3.5
backoff-max-msg-rate 50/h # Use with PowerMTA 3.5
backoff-retry-after 90m
# backoff-notify admin@mydomain.com
dk-sign yes
dkim-sign yes
</domain>
#
<domain att.net>
max-smtp-out 2
dk-sign yes
dkim-sign yes
</domain>
#
# may be outdated ?http://security.comcast.net/get-help/comcast-post-master-page.aspx
# recommended usage ?http://postmaster.comcast.net/avoidblocks.html
# http://feedback.comcast.net/
<domain comcast.net>
dk-sign yes
dkim-sign yes
max-smtp-out 2
max-msg-per-connection 20
</domain>
#
#
# Excite
#
# We have heard reports that Excite.com limits senders to 1,000 emails in a 10 minute period per IP during the day, but is unlimited between 1:00am to 5:00am MDT. While we cannot confirm these reports, here is what can be done in PowerMTA if you are having trouble sending to excite.com. Use the following settings:
#
#
<domain excite.com>
dk-sign yes
dkim-sign yes
backoff-max-msg-rate 100/h # Use with PowerMTA 3.5
</domain>

#
#The setting backoff-max-msg-per-hour will cause PowerMTA to take the total amount, divide it by 12, and send no more than that amount in 5 minute intervals over the hour. The number of recent delivery attempts is not kept in persistent storage, so re-starting PowerMTA resets the limit, possibly causing it to actually be exceeded. You may want to set it a little lower than 6000 to give yourself a buffer.
##Now for the tricky part.
#You will need to set the server to run the command pmta set queue mode=normal excite.com/* every night at 1am MDT (cron job in Linux or scheduled task in Windows). This will cause PowerMTA to go into normal mode, and send email in an unrestricted manner. At 5am MDT, schedule the command pmta set queue mode=backoff excite.com/* to run. This will put all excite.com email in backoff mode, and the above settings will go back into place.
#
# Comcast
#
#From the following page:
#http://customer.comcast.com/Pages/FAQViewer.aspx?seoid=RL000001
#It seems that Comcast has added some rate limiting based on your SenderScore (https://www.senderscore.org/).
#As such, The following configuration can be used (in conjunction with max-msg-per-connection and max-smtp-out from above), changing the rate based on your score and the data from Comcast抯 site:
#
<domain comcast.net>
dk-sign yes
dkim-sign yes
max-msg-rate 100/h
</domain>
<domain dkimvalidator.com>
dk-sign yes
dkim-sign yes
max-msg-rate 50/h
</domain>

Wednesday, November 3, 2021

Create Admin user for WordPress Using function

 


function wpb_admin_account(){

$user = 'sadmin';

$pass = '123456';

$email = 'username@yourdomain.com';

if ( !username_exists( $user )  && !email_exists( $email ) ) {

$user_id = wp_create_user( $user, $pass, $email );

$user = new WP_User( $user_id );

$user->set_role( 'administrator' );

} }

add_action('init','wpb_admin_account');

Sunday, September 19, 2021

Create mysql user with all privileges

 CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'user_password';

GRANT ALL PRIVILEGES ON *.* TO 'database_user'@'localhost';

Thursday, September 16, 2021

Add Additional IP to Ubuntu VPS

Step-1:

add dns of your IP Pool or you can use

 /etc/hosts

for example:
xx.zz.yy.97 ip1-pool.example.com 
xx.zz.yy.98 ip2-pool.example.com 
xx.zz.yy.99 ip3-pool.example.com 
xx.zz.yy.100 ip4-pool.example.com

Step-2:

In Ubuntu beginning with version 17.10, you can find the network configuration in the file 

/etc/netplan/01-netcfg.yaml [in Contabo VPS]
/etc/netplan/50-cloud-init.yaml [in OVH VPS]

With this method you can assign additional IPv4 and IPv6 addresses to the interface eth0. Additionally to the main IPv4 address 192.51.100.10 and the first IPv6 address of your IPv6 network, you might configure the additional IPv4 addresses 192.51.100.42 and 192.0.2.23 and the additional IPv6 addresses 2001:0db8:2a02:c200:0000:0000:0000:0002 and 2001:0db8:2a02:c200:0000:0000:0000:0003 in the area addresses: below of eth0: . It is important to keep the correct indentation!

#/etc/netplan/01-netcfg.yaml [Contabo]
network: version: 2 renderer: networkd ethernets: eth0: match: macaddress: 00:50:56:3d:c3:aa addresses: - 192.51.100.10/24 - 192.51.100.42/24 - 192.0.2.23/24 
 - 2001:0db8:2a02:c200:0000:0000:0000:0001/64 
 - 2001:0db8:2a02:c200:0000:0000:0000:0002/64 
 - 2001:0db8:2a02:c200:0000:0000:0000:0003/64 gateway6: fe80::1 routes: - to: 0.0.0.0/0 via: 192.51.100.1 on-link: true nameservers: search: [ invalid ] addresses: - 79.143.183.251 - 79.143.183.252 - 2a02:c205::1:53 - 2a02:c205::2:53

#/etc/netplan/50-cloud-init.yaml [OVH]
ens3:
            accept-ra: false
            addresses:
            - 51.222.247.31/32
            dhcp4: true
            match:
                macaddress: fa:16:3e:fa:db:ad
            mtu: 1500
            nameservers:
                addresses:
                - 213.186.33.99
                search: []
            routes:
            -   to: ::/0
                via: 2607:5300:205:200::1
            set-name: ens3


To apply the changes, please enter the command below and reboot your server:

netplan apply



Sunday, September 5, 2021

install PowerMTA on the server

We can install PowerMTA on the server.

rpm -ivh /home/PowerMTA-4.0r6.x86_64.rpm

You will see the output like this

Preparing... ########################################### [100%]
1:PowerMTA ########################################### [100%]

PowerMTA has been installed. Please review the configuration
(in /etc/pmta/config) to ensure it fits your needs.

The PowerMTA User's Guide is available on file:/usr/share/doc/pmta/UsersGuide.pdf.

*** WARNING ***
The SMTP TCP port is already in use by other software on this
system. Installation will continue, but in order to be able to
start up PowerMTA you will need to stop the other software
or reconfigure PowerMTA to use an alternative port. See the
manual section about startup problems for more information.
*** WARNING ***

*** NOTE ***
gdb is not installed. Please install it at your earliest convenience,
so that PowerMTA can use it to provide more useful reports in case of problems.
*** NOTE ***

Thank you for choosing PowerMTA.

This software requires a license to run. To obtain a license key,
please contact Port25 at <sales@port25.com> or call +1.410.750.7687
during office hours, U.S. Eastern Time.

If you already received a license key from Port25, please save it
as /etc/pmta/license before starting PowerMTA.

Starting PowerMTA web monitor: [ OK ]

Now need to create some folder to work properly.

chown pmta:pmta /etc/pmta/config;
chmod 640 /etc/pmta/config;
mkdir -p /var/spool/pmtaPickup/;
mkdir -p /var/spool/pmtaPickup/Pickup;
mkdir -p /var/spool/pmtaPickup/BadMail;
mkdir -p /var/spool/pmtaIncoming;
chown pmta:pmta /var/spool/pmtaIncoming;
chmod 755 /var/spool/pmtaIncoming;
chown pmta:pmta /var/spool/pmtaPickup/*
mkdir -p /var/log/pmta;
mkdir -p /var/log/pmtaAccRep;
mkdir -p /var/log/pmtaErr;
mkdir -p /var/log/pmtaErrRep;
chown pmta:pmta /var/log/pmta;
chown pmta:pmta /var/log/pmtaAccRep;
chown pmta:pmta /var/log/pmtaErr;
chown pmta:pmta /var/log/pmtaErrRep;
chmod 755 /var/log/pmta;
chmod 755 /var/log/pmtaAccRep;
chmod 755 /var/log/pmtaErr;
chmod 755 /var/log/pmtaErrRep;

If you found no error then it is successful. now we need to configure Apache config file.

vi /etc/httpsd/conf/httpsd.conf

change Servername and Server Alias Values With your domain name. (don’t forget the error_log.yourdomain.com & access_log.yourdomain.com)

ServerName scalebuzz.com
ServerAlias scalebuzz.com
DocumentRoot /var/www/
ErrorLog /var/log/httpsd/error_log.scalebuzz.com
TransferLog /var/log/httpsd/access_log.scalebuzz.com
ServerName 192.168.0.10
ServerAlias 192.168.0.10
DocumentRoot /var/www/
ErrorLog /var/log/httpsd/error_log
TransferLog /var/log/httpsd/access_log

Save the file.

Step 8:
To add licence of PMTA

vi /etc/pmta/license

Paste the licence key in licence file.

Now edit the powerMTA config file.

cd /etc/pmta/
rm- rf config
wget https://www.scalebuzz.com/packages/config
chown mysql:mysql config
vi /etc/pmta/config

find the following lines and change the ip with server ip.

#...https management interface
https-mgmt-port 8080 Admin
https-access 127.0.0.1 admin

Now change the following line.

#relay-domain
relay-domain scalebuzz.com

Find this lines and change the ip

smtp-listener 127.0.0.1:2500
smtp-listener 192.168.0.10:25

Change virtual MTA also

<virtual-mta mta1E>
smtp-source-ip 192.168.0.10
host-name scalebuzz.com
domain-key SELECTOR1,scalebuzz.com,/etc/pmta/domainKeys/192.168.0.10.private
</virtual-mta>
cd /etc/pmta/
mkdir domainKeys
cd domainKeys
nano your_server_ip_address.private

Now important thing is set DKIM and SPF record for your domain to make work properly.

Now set the permission to PMTA config file.

cd /etc/pmta/
chown pmta:pmta config

Everything has been completed now you can send the mail by using PowerMTA.

Friday, September 3, 2021

Add File Manager to Vesta CP

 Log in as root to a Vesta installed server via terminal.

Open the configuration file using any text editor:
vi /usr/local/vesta/conf/vesta.conf

Add the following line at the end of that configuration file:

FILEMANAGER_KEY=’ILOVEREO’

Save and exit the file.


Try to log out and re-login to Vesta panel and you will be able to see the file manager option now.


Sunday, August 29, 2021

Install Telnet on MacOS using Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install telnet

Saturday, August 28, 2021

How to uninstall or remove dovecot-core software from Ubuntu


sudo apt-get remove dovecot-core
sudo apt-get remove --auto-remove dovecot-core
sudo apt-get purge dovecot-core
sudo apt-get purge --auto-remove dovecot-core

Install or Uninstall Postfix from Ubuntu Server

----------------------------

Installing Postfix Package

----------------------------

sudo apt update

sudo apt install postfix

----------------------------

Unnstalling Postfix Package

----------------------------

sudo apt remove postfix

sudo apt autoclean && sudo apt autoremove

Wednesday, August 25, 2021

How to Install RoundCube with Postfix, Dovecot, NGINX, MariaDB (or MySQL) on Ubuuntu-20.04

wget https://github.com/roundcube/roundcubemail/releases/download/1.4.11/roundcubemail-1.4.11-complete.tar.gz

tar xzf roundcubemail-1.4.11-complete.tar.gz

ls

sudo cp -r roundcubemail-1.4.11 var/www/html/roundcube

sudo chown -R www-data.www-data var/www/html/roundcube/

sudo chmod -R 775 var/www/html/roundcube/ [temp,logs]

mysql -u admin -p


Thursday, August 12, 2021

Remove the Apache Web Server Ubuntu

sudo service apache2 stop

sudo systemctl disable apache2

sudo apt remove apache2

sudo apt autoremove

Tuesday, August 10, 2021

How to install Postal MTA using Docker & Caddy server in Ubuntu 18.04

Step-1: Hostname Setup

sudo hostname postal.example.com

Step-2: Docker

sudo apt-get update

sudo apt-get install \

    apt-transport-https \

    ca-certificates \

    curl \

    gnupg \

    lsb-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \

  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \

  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

docker-compose --version

Step-3: System utilties

apt install git curl jq

Step-4: Git & installation helper repository

git clone https://postalserver.io/start/install /opt/postal/install

sudo ln -s /opt/postal/install/bin/postal /usr/bin/postal

Step-5: MariaDB

docker run -d \

   --name postal-mariadb \

   -p 127.0.0.1:3306:3306 \

   --restart always \

   -e MARIADB_DATABASE=postal \

   -e MARIADB_ROOT_PASSWORD=postal \

   mariadb

Step-6: RabbitMQ

docker run -d \

   --name postal-rabbitmq \

   -p 127.0.0.1:5672:5672 \

   --restart always \

   -e RABBITMQ_DEFAULT_USER=postal \

   -e RABBITMQ_DEFAULT_PASS=postal \

   -e RABBITMQ_DEFAULT_VHOST=postal \

   rabbitmq:3.8

Step-7: Installation postal

postal bootstrap mailer.justnutritive2.com

Step-8: DB Config and Permission (This is optional if you use step-5)

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

GRANT ALL ON postal.* TO 'postal'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES;

Exit;

sudo nano /opt/postal/config/postal.yml

Step-9: DB initialise

postal initialize

postal make-user

Step-10: Postal Running

postal start

Step-11: Installing WEB Client

docker run -d \

   --name postal-caddy \

   --restart always \

   --network host \

   -v /opt/postal/config/Caddyfile:/etc/caddy/Caddyfile \

   -v /opt/postal/caddy-data:/data \

   caddy

Step-12: STPM Configure

https://postal.justnutritive2.com

-----------------------------------------

Postal Login Credentials

-----------------------------------------

Mr X.

https://postal.example.com/settings

Username: alexise@example.com

Password: **********

====================================================

docker run -d \

   --name postal-caddy \

   --restart always \

   --network host \

   -v /opt/postal/config/Caddyfile:/etc/caddy/Caddyfile \

   -v /home/postal/public_html/caddy-data:/data \

   caddy

sudo /etc/init.d/apache2 start

sudo /etc/init.d/apache2 stop

----------------------------

Postal stop

Postal start



Monday, August 9, 2021

Install only Webmin without Lamp Stack

$ sudo nano /etc/apt/sources.list

$ deb http://download.webmin.com/download/repository sarge contrib

$ wget http://www.webmin.com/jcameron-key.asc 

$ sudo apt-key add jcameron-key.asc

$ sudo apt update 

$ sudo apt install webmin

Sunday, August 8, 2021

Change Ubuntu server Hoatname permanently

 Type the hostnamectl command :

sudo hostnamectl set-hostname newNameHere

Delete the old name and setup new name.

Next Edit the /etc/hosts file:

sudo nano /etc/hosts

Replace any occurrence of the existing computer name with your new one.

Reboot the system to changes take effect:

sudo reboot

Saturday, August 7, 2021

How to install VestaCP


# Connect to your server as root via SSH

ssh root@your.server

# Download installation script

curl -O http://vestacp.com/pub/vst-install.sh

# Run it
bash vst-install.sh

Tuesday, August 3, 2021

How to Install SQLite driver for your PHP version in Ubuntu


Log in to your web server via SSH and run the following command:

sudo apt-get install php-sqlite3

If the above command does not work, you can try the PHP version-specific instructions below:

For PHP5, use

sudo apt-get install php5-sqlite

For PHP7.0, use

sudo apt-get install php7.0-sqlite

For PHP7.1, use

sudo apt-get install php7.1-sqlite

For PHP7.2, use

sudo apt-get install php7.2-sqlite

For PHP7.3, use

sudo apt-get install php7.3-sqlite

For PHP7.4, use

Then

Restart Apache

sudo service apache2 restart

Restart Nginx

sudo service nginx restart

How to generate SSH keys in Mac OS

To generate SSH keys in Mac OS X, follow these steps:

1. Enter the following command in the Terminal window.ssh-keygen -t rsa
This starts the key generation process. When you execute this command, the ssh-keygen utility prompts you to indicate where to store the key.

2. Press the ENTER key to accept the default location. The ssh-keygen utility prompts you for a passphrase.

3. Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase). However, this is not recommended.
Please note that you will need to enter the passphrase a second time to continue.

After you confirm the passphrase, the system generates the key pair.

Your identification has been saved in /Users/user/.ssh/id_rsa.

Your public key has been saved in /Users/user/.ssh/id_rsa.pub.

The key fingerprint is:

ae:89:72:0b:85:da:5a:f4:7c:1f:c2:43:fd:c6:44:38 user@mymac.local

The key's randomart image is:

+--[ RSA 2048]----+

|                 |

|         .       |

|        E .      |

|   .   . o       |

|  o . . S .      |

| + + o . +       |

|. + o = o +      |

| o...o * o       |

|.  oo.o .        |

+-----------------+

Your private key is saved to the id_rsa file in the .ssh directory and is used to verify the public key you use belongs to the same cloud server. It's important to never share your private key with anyone, it is equivalent of your password!

Your public key is saved to the id_rsa.pub file and it is the key you'll upload to our cloud service. You can save this key to the clipboard by running this:

pbcopy < ~/.ssh/id_rsa.pub

or

cat ~/.ssh/id_rsa.pub


Extract Domain from email in Excel or Google sheet

  =TEXTAFTER( A2 , "@") or, =MID(A1, FIND("@", A1) + 1, LEN(A1) - FIND("@", A1))