Из отчета хотелось бы доставать email на который не дошло письмо и текст ошибки доставки.
Интересует алгоритм работы с текстами (доставание оттуда инфы, которая может размещаться в разных местах текста), реализация этого алгоритма на perl в частности. Можно просто ссылки на аналогичные скрипты, можно даже на других языках.
Пример самого распространенного типа отчета об ошибке:
Код: Выделить всё
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:
morosowwa.tat@yandex.ru
SMTP error from remote mail server after RCPT TO:<morosowwa.tat@yandex.ru>:
host mx.yandex.ru [87.250.250.89]: 550 5.7.1 No such user!
Код: Выделить всё
This message was created automatically by mail delivery software.
A message that you sent has not yet been delivered to one or more of its
recipients after more than 24 hours on the queue on mailer.smartresponder.ru.
The message identifier is: 1QlZXa-000E6I-Dd
The date of the message is: Tue, 26 Jul 2011 08:46:45 +0400
The subject of the message is: =?windows-1251?B?T3JpY28uIMLg+CDv8Ojh++v87fvpIEFMUEhBLeHr7uMhIDIuMA==?=
The address to which the message has not yet been delivered is:
orico@km.ru
Delay reason: SMTP error from remote mail server after end of data:
host m2.mx.km.ru [217.197.114.195]: 450 4.4.2 Bad connection
No action is required on your part. Delivery attempts will continue for
some time, and this warning may be repeated at intervals if the message
remains undelivered. Eventually the mail delivery software will give up,
and when that happens, the message will be returned to you.