Примеры работы с почтовой очередью в exim
Из простого:
exim -bpc #количество писем в очереди
exim -bp #вывести список всех писем
Чуть интереснее
exim -bp | exiqsumm #покажет общую статистику
Выглядит это примерно так:
Count Volume Oldest Newest Domain
----- ------ ------ ------ ------
10 33KB 29h 5h example.com
---------------------------------------------------------------
10 33KB 29h 5h TOTAL
exim -Mvh message-ID #покажет заголовки письма
exim -Mvb message-ID #покажет само письмо
Пример
[root@site ~]# exim -Mvh 1qA1ZJ-0000e4-0Y
1qA1ZJ-0000e4-0Y-H
exim 93 93
<>
1686891617 0
-received_time_usec .170940
-received_time_complete 1686891617.177895
-ident exim
-received_protocol local
-aclc 8 0
-body_linecount 58
-max_received_linelength 258
-allow_unqualified_recipient
-allow_unqualified_sender
-frozen 1686891617
-localerror
-tls_resumption A
XX
1
webmaster@example.com
147P Received: from exim by site.hostname.com with local (Exim 4.96)
id 1qA1ZJ-0000e4-0Y
for webmaster@example.com;
Fri, 16 Jun 2023 08:00:17 +0300
044 X-Failed-Recipients: mail@gmail.com
029 Auto-Submitted: auto-replied
062F From: Mail Delivery System <Mailer-Daemon@site.hostname.com>
026T To: webmaster@example.com
067 References: <f65ca44115da38a702bdf4e00a400fb7@check.domain.ru>
100 Content-Type: multipart/report; report-type=delivery-status; boundary=1686891617-eximdsn-1357383860
018 MIME-Version: 1.0
059 Subject: Mail delivery failed: returning message to sender
051I Message-Id: <E1qA1ZJ-0000e4-0Y@site.hostname.com>
038 Date: Fri, 16 Jun 2023 08:00:17 +0300
[root@site ~]# exim -Mvb 1qA1ZJ-0000e4-0Y
1qA1ZJ-0000e4-0Y-D
--1686891617-eximdsn-1357383860
Content-type: text/plain; charset=us-ascii
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
teamlevelcom@gmail.com
host gmail-smtp-in.l.google.com [108.177.119.27]
SMTP error from remote mail server after pipelined end of data:
550-5.7.26 The MAIL FROM domain [example.com] has an SPF record with a hard fail
550-5.7.26 policy (-all) but it fails to pass SPF checks with the ip:
550-5.7.26 [195.123.218.121]. To best protect our users from spam and phishing,
550-5.7.26 the message has been blocked. Please visit
550-5.7.26 https://support.google.com/mail/answer/81126#authentication for more
550 5.7.26 information. pv9-20020a170907208900b00965a5941cbcsi6250261ejb.982 - gsmtp
--1686891617-eximdsn-1357383860
Content-type: message/delivery-status
Reporting-MTA: dns; site.hostname.com
Action: failed
Final-Recipient: rfc822;mail@gmail.com
Status: 5.0.0
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.7.26 The MAIL FROM domain [example.com] has an SPF record with a hard fail
550-5.7.26 policy (-all) but it fails to pass SPF checks with the ip:
550-5.7.26 [195.123.218.121]. To best protect our users from spam and phishing,
550-5.7.26 the message has been blocked. Please visit
550-5.7.26 https://support.google.com/mail/answer/81126#authentication for more
550 5.7.26 information. pv9-20020a170907208900b00965a5941cbcsi6250261ejb.982 - gsmtp
--1686891617-eximdsn-1357383860
Content-type: message/rfc822
Return-path: <webmaster@example.com>
Received: from isplic by site.hostname.com with local (Exim 4.96)
(envelope-from <webmaster@example.com>)
id 1qA1ZI-0000ds-2a
for teamlevelcom@gmail.com;
Fri, 16 Jun 2023 08:00:16 +0300
To: mail@gmail.com
Subject: ---
X-PHP-Originating-Script: 514:class-phpmailer.php
Date: Fri, 16 Jun 2023 05:00:16 +0000
From: Check <check@domain.ru>
Message-ID: <f65ca44115da38a702bdf4e00a400fb7@check.domain.ru>
X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
тут текст письма
--1686891617-eximdsn-1357383860--
Для поиска писем можно использовать команду
exiqgrep -f user@search.dom #Поиск по email или домену в очереди писем
Очистка:
exiqgrep -i -f user@test.com | xargs exim -Mrm #удалить все письма где отправиель user@test.com
exiqgrep -i -r user@test.com | xargs exim -Mrm #удалить все письма где получатель user@test.com
exipick -zi | xargs exim -Mrm #удалить все frozen письма
exipick -i | xargs exim -Mrm #очистить всю очередь
rm -rf /var/spool/exim/input #очистить всю очередь. Более быстрый способ