Mail system Maintenance

Source: Internet
Author: User
Tags chmod qmail
mail system maintenance:

mail system related logs

/var/log/maillog
/var/log/qmail/current
/var/log/qmail/pop3d/current
/var/log/qmail/pop3ds/current
/var/log/qmail/smtpd/current
/var/spool/qmailscan/qmail-queue.log
/var/spool/qmailscan/qms-events.log
/var/spool/qmailscan/quarantine.log

set the capacity of QMail user mailboxes
# Cd/home/vpopmail/bin
#./vsetuserqutoa domain.com 10500000s--domain.com This domain, all set to 10m
#./vsetuserqutoa xuki@domain.com 10500000s---Only xuki@domain.com this user is set to 10m alone.

Bulk Add Users

Example 1:

Create a new file batchadduser.sh, save the following in a file, run chmod u+x batchadduser.sh make it executable.

#!/bin/bash
#batchadduser. sh:batch Add Mail user.
#install step.
#chmod u+x Batchadduser
#./batchadduser.sh Domain datafile
If [$#-lt 2]
Then
echo "Usage: $ domain datafile"
Exit 1
Fi
Domain=$1
Datafile=$2
Addcmd=/home/vpopmail/bin/vadduser
While read username passwd
Todo
$addcmd $username @ $domain $passwd
Done < $datafile

Format of user file contents
UserName1 passwd
UserName2 PASSWD2
............

You can add users in batches by running batchadduser.sh user.

Example 2:

I put the user name in a text file, a name line, the password and its account number consistent, users to change their password.

While Read line
Todo
Echo $line
./vadduser $line $line
Done < user

Selectively cleans unwanted mail Queue

1, processing the message in the queue:

If you want the message in the queue to be delivered immediately, you can
# Kill-hup Qmail-send
To delete a message in a queue
1) Stop QMail
2) mv/var/qmail/queue/lock/var/qmail/;find/var/qmail/queue/-type f-exec rm {}/; Mv/var/qmail/lock/var/qmail/queue /
3) Restart QMail.
The messages in the queue are included in the following directory/var/qmail/queue/{info,mess,remote,local}/hash/#number
2, in the mail queue to quickly remove from a place sent over but not exist mail set bad.jite.com is this domain. You can type the following command
# echo # > ~alias/.qmail-baddomain-default
# echo Bad.jite.com:alias-baddomain>>/var/qmail/control/virtualdomains
# echo bad.jite.com:127.0.0.1 >>/var/qmail/control/smtproutes
Then run/var/qmail/bin/qmail-tcpok and give Qmail-send a hup signal.
3, delete a lot of advertising information in the queue

Stop QMail first.
1) Stop qmail, QMAIL-SMTPD
2) in the following default directory/var/qmail/queue/mess
Find/var/qmail/queue/mess-type f-exec grep "^subject:dss" {}/; -print-exec RM {}/;
3) Run Queue-fix to clear the relevant files,
4) Restart QMail.

the method of backing up Qmail+mysql data to a specified FTP address using SH
backs up the domains directory of Vpopmail, the QMail control directory, and the MySQL var data storage directory. Use crontab timing to operate. Here is the script file, the specific directory depending on your system changes:
Mkdir/var/qmailbakup
Cd/var/qmailbakup
Touch qmailbakup.sh
chmod 755 Qmailbakup. SH
vi qmailbakup.sh
[code:1:d480555598]
#!/bin/sh
date= ' DATE +%y-%m-%d-%h '
cd/var/ qmailbakup/
Tar cvzf domains. $DATE. tar.gz/home/vpopmail/domains
Tar cvzf control. $DATE. tar.gz/var/qmail/ Control
Tar cvzf mysql. $DATE. Tar.gz/usr/local/mysql/var
ftp-n 192.168.0.21 <<!//Your FTP server's address
user Qma Il qmailbakup//ftp username and password, note that you want to have the put permission
binary
to place domains. $DATE. tar.gz
Take control. $DATE. tar.gz
. $DATE. tar.gz
Bye
!
rm-f domains. $DATE. tar.gz control. $DATE. tar.gz MySQL. $DATE. tar.gz//Delete native generated files, if you want to save a copy of this server, remove the item.
[/code:1:d480555598]
uses crontab timed execution:
Vi/etc/crontab
* * 0-6/var/qmailbakup/qmailbakup.sh
So every night 8:00 to perform a backup program.

The solution to the letter to Sina
QMail
echo "Real domain name of my mail server (a record)" >/var/qmail/control/helohost

Temporarily restrict a user's POP3
Vmoduser-p email_addr or domain (for the entire domain)

Modify the Default domain name
A:
To change the haohao.com as the default domain.
Method:
Change ~qmail/control/
DefaultDomain
Me
Plusdomains
Change startup scripts that start POP3 and SMTP individually:
Modified: email.3sk.com for haohaoo.com
Add at top: Export vpopmail_domain=haohaoo.com

complete transfer of a system's qmail user to another system
A:
A.CDB configured? Then please/home/vpopmail/domains this folder back to the good. User and password files, and user letters are all in this directory.
You should also back up the related configuration files under/var/qmail/control.

B. If you are storing user authentication information in a MySQL database
Only need to back up
All messages under the ~vpopmail/domain
/var/qmail/control configuration file
The Vpopmail Library directory under the MySQL database directory. Usually/var/lib/mysql (RPM),/usr/local/mysql/data,/usr/local/mysql/var below.

To change the name of a mail domain like a.com to b.com, how to achieve
Here are a few steps:
1, Cd/home/vpopmail/domains
MV A.com B.Com
2, the Vpopmail Database vpopmail table export all a.com to B.Com, and then delete the Vpopmail table, and then import.
3. Change the a.com of the Dir_control table of the Vpopmail database to B.Com
4, in the/home/qmail/control directory under the Virtualdomains and Rcpthosts under the a.com changed to B.Com.
5, in the/home/qmail/users directory of assign documents a.com to B.Com
6, need to run Qmail-newu regenerate cdb. Assign is just a configuration file, CDB is the actual data file.
Speed up the delivery of qmail messages
A:/var/qmail/control below is the QMail control file, these two files:
Maximum local simultaneous transfer of concurrentcylocal Default:10
Concurrencyremote default:20 maximum remote simultaneous transfer number
Change the default admin account for a domain
A:vmoduser has a-a parameter that gives users administrative privileges.

If you want to completely disable Postmaster special permissions, you can only change the source code.

main configuration files under QMail (/var/qmail/control directory):
FileName Default value consumer use
Badmailfrom None qmail-smtpd blacklist address
Bouncefrom Mailer-daemon qmail-send return mail
Bouncehost Me qmail-send return message
Number of concurrencylocal Qmail-send local simultaneous postings
Number of Concurrencyremote Qmail-send delivered to the remote host at the same time
DefaultDomain me qmail-inject Default domain name
Defaulthost me qmail-inject Default host name
Databytes 0 QMAIL-SMTPD Maximum capacity of messages (0= Unlimited)
Doublebouncehost Me Qmail-send
Doublebounceto Postmaster Qmail-send
Envnoathost me Qmail-send has no Default domain name for "@"
Helohost Me qmail-remote host name
Idhost me qmail-inject Message-id host name
Localiphost me qmail-smtpd alternate name for local IP
Locals me qmail-send to a local domain name
Me system official domain name various
Morercpthosts None qmail-smtpd a second rcpthosts
Percenthack None qmail-send using the "%" format domain name
Plusdomain Me Qmail-inject
Qmqpservers the IP address of the None QMAIL-QMQPC QMQP server
Queuelifetime 604800 Qmail-send The time that messages are saved in the queue (in seconds)
Rcpthosts None qmail-smtpd the domain name that receives the message
Smtpgreeting Me qmail-smtpd
Smtproutes None Qmail-remote
Timeoutconnect qmail-remote SMTP Connection timeout
Timeoutremote 1200 qmail-remote waiting for remote host time
TIMEOUTSMTPD 1200 qmail-smtpd SMTP Client connection timeout
Virtualdomains None qmail-send Virtual domain name

QMail Limit Attachment Size
My configuration Experience = = QMail limit attachment size:
1. Set the attachment size in/var/qmail/control/databytes, this file should be manually established, directly enter the number on the line, the default unit is bytes, such as 10485760 10M;
2.Webmail send attachments By default only support 500K, if you want to support 5M accessories, modify the following file
# Vi/etc/php.ini

post_max_filesize=5m//320 Line
upload_max_filesize=5m//405 Line
Session.bug_compat_42=0//Join to 641 line
Session.bug_compat_warn=0

# vi/etc/httpd/conf.d/php.conf
Limitrequestbody 5242880//Modify the value of line 14 to 5M

Webmail upload Attachment size limit (to solve the problem of uploading files can not be greater than 512KB)
Change/etc/httpd/conf.d/php.conf:

The 524288 in Limitrequestbody 524288 is exactly the same as 512KB, change it to 10485760, and set the attachment that allows the maximum upload to 10MB.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.