exim

# view the queue

exim -bp

/usr/sbin/exim -bpr | grep "<" | wc -l    =>Number of emails in the que

4d  1.2K 1Ka6u5-00032Z-Eb <from@example.com>
              to@example.com

how long the email message has been in the queue

# Flush the exim mail queue

exim -q

# Force delivery of one message
exim   -M   email-id

# To remove a message from the queue

exim -Mrm {message-id}

# To remove all messages from the queue

exim -bp | exiqgrep -i | xargs exim -Mrm

/var/spool/exim

-H for headers an -D for body file

cd /var/spool
mv exim exim.old
mkdir -p exim/input
mkdir -p exim/msglog
mkdir -p exim/db
chown -R mail:mail exim
/sbin/service exim restart

# 看 config 的設定

exim -bP [opts]

# Freeze a message:

root@localhost# exim -Mf <message-id>

# un-Freeze:

root@localhost# exim -Mt <message-id>

[root@mail exim]# exim -bP authenticator_list
plain
login

# Force a message to fail and bounce as "cancelled by administrator":

exim -Mg <message-id>

# View a message's headers:

root@localhost# exim -Mvh <message-id>

# View a message's body:

root@localhost# exim -Mvb <message-id>

# View a message's logs:

root@localhost# exim -Mvl <message-id>

[root@mail exim]# exim -bP authenticators

plain authenticator:
client_condition =
driver = plaintext
public_name = PLAIN
server_advertise_condition =
server_condition = ${perl{smtpauth}}
server_debug_print =
server_mail_auth_condition =
server_set_id = $2
no_client_ignore_invalid_base64
client_send =
server_prompts = :

login authenticator:
client_condition =
driver = plaintext
public_name = LOGIN
server_advertise_condition =
server_condition = ${perl{smtpauth}}
server_debug_print =
server_mail_auth_condition =
server_set_id = $1
no_client_ignore_invalid_base64
client_send =
server_prompts = Username:: : Password::

[root@mail exim]# exim -bP authenticator plain
client_condition =
driver = plaintext
public_name = PLAIN
server_advertise_condition =
server_condition = ${perl{smtpauth}}
server_debug_print =
server_mail_auth_condition =
server_set_id = $2
no_client_ignore_invalid_base64
client_send =
server_prompts = :

host_auth_accept_relay = *
host_accept_relay = 10.9.8.0/24

exim.conf
perl_startup = do '/etc/exim.pl'

        {
                #the username contain a domain, which is now in $domain.
                #this is a pure virtual pop account.

                open(PASSFILE, "< /etc/virtual/$domain/passwd") || return "no";
                while (<PASSFILE>)
                {
                        ($test_user,$test_pass) = split(/:/,$_);
                        $test_pass =~ s/\n//g; #snip out the newline at the end
                        if ($test_user eq $username)
                        {
                                if ($test_pass eq crypt($password, $test_pass))
                                {
                                        close PASSFILE;
                                        return "yes";
                                }
                        }
                }
                close PASSFILE;
                return "no";
        }

# Print a summary of messages in the queue

exim -bp | exiqsumm

# Print what Exim is doing

exiwhat

# sender

exiqgrep -f [luser]@domain

# recipient

exiqgrep -r [luser]@domain

# older than the specified number of seconds.

exiqgrep -o 86400

# younger than the specified number of seconds.

exiqgrep -y 3600 [...]

# size of a message with a regex.

exiqgrep -s '^7..$' [...]


Frozen messages without sender

Frozen mails are mails to invalid mail accounts. If the mail can't be delivered for an account, the mail will be added in the queue and exim will try a couple of times to deliver the mail as per the settings in the RETRY CONFIGURATION in exim conf file.

usr/sbin/exim -bpr | grep frozen | wc -l   => How many Frozen mails on the queue

/usr/sbin/exim -bpr | grep frozen | awk '{print $3}' | xargs exim -Mrm   =>  Deleteing Frozen Messages

 


too many connections

2014-04-16 10:52:40 Connection from [61.244.xx.xx] refused: too many connections

/etc/exim.conf
smtp_accept_max                       <-- ps -e | grep exim |wc -l
smtp_accept_max_per_host

 -A INPUT -i eth0 -p tcp -m tcp --dport 25 -m limit --limit 20/min -j ACCEPT