Finding email's subject and ID when you have non-English characters in subject
From MyWiki
(Difference between revisions)
Admin (Talk | contribs)
(Created page with 'Working for multinational companies bring interesting challenges :-) Once I needed to find out subject and email ID of the deferred emails in our Postfix. First grabbed the defe…')
Newer edit →
(Created page with 'Working for multinational companies bring interesting challenges :-) Once I needed to find out subject and email ID of the deferred emails in our Postfix. First grabbed the defe…')
Newer edit →
Revision as of 18:17, 28 February 2015
Working for multinational companies bring interesting challenges :-) Once I needed to find out subject and email ID of the deferred emails in our Postfix.
First grabbed the deferred emails from /var/spool/mqueue/deferred If you are dealing with PureMessage for UNIX, the you find deferred emails in /opt/pmx6/postfix/var/spool/mqueue/deferred
for e in `ls -1 /home/alex/deferred/`; do str=`LANG=fr_FR.UTF-8 sed -n 's/.*Subject:\(.*\)X-PHP.*/\1/p' /home/alex/deferred/${e}`; echo ${e} ${str}; done
To get the "To:" address and the subject:
for e in `ls -1 /home/alex/deferred/`; do to=`LANG=fr_FR.UTF-8 sed -n 's/.*To:\(.*\)N.*Subject.*/\1/p' /home/alex/deferred/${e}`; str=`LANG=fr_FR.UTF-8 sed -n 's/.*Subject:\(.*\)X-PHP.*/\1/p' /home/alex/deferred/${e}`; echo ${to}"%%"${str}; done
Or:
for e in `ls -1 /home/alex/deferred_address_typo/`; do to=`LANG=fr_FR.UTF-8 sed -n 's/.*To:.*<\(.*\)>N.*Subject.*/\1/p' /home/alex/deferred_address_typo/${e}`; str=`LANG=fr_FR.UTF-8 sed -n 's/.*Subject:\(.*\)From:.*/\1/p' /home/alex/deferred_address_typo/${e}`; echo ${to}"%%"${str}; done