How to get the ID and Receiver mail address details from postfix [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have the following message output when I use postcat -q CEEFE416EAB5:



*** ENVELOPE RECORDS deferred/C/CEEFE416EAB5 ***
message_size: 375 253 1 0 375
message_arrival_time: Thu Dec 6 13:32:19 2018
create_time: Thu Dec 6 13:33:48 2018
named_attribute: rewrite_context=local
sender_fullname: root
sender: root@localhost.localdomain
original_recipient: testmailreciever001@localhost.com
recipient: testmailreciever001@localhost.com
*** MESSAGE CONTENTS deferred/C/CEEFE416EAB5 ***
Received: by localhost.localdomain (Postfix, from userid 0)
id CEEFE416EAB5; Thu, 6 Dec 2018 13:33:48 +0900 (JST)
From:testmailsender100@localhost.com
To:testmailreciever001@localhost.com
Subject:TestMail_Postfix
Message-Id: <20181206043348.CEEFE416EAB5@localhost.localdomain>
Date: Thu, 6 Dec 2018 13:32:19 +0900 (JST)

Sending Testmail to testmailreciever001

*** HEADER EXTRACTED deferred/C/CEEFE416EAB5 ***
*** MESSAGE FILE END deferred/C/CEEFE416EAB5 ***


I need to extract the output the subject and the recipient from the corresponding lines in the header (Subject: and recipient:) (using a shell script) in the following format, and to be write in the /var/log/message using logger



OUTPUT FORMAT:
QUEUE ID SUBJECT RECIPIENT

EXPECTED OUTPUT:
CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


Spaces have been added above
to clarify the column-oriented nature of the expected output. 
The expected output should actually separate the fields
with a single space:



CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


The commands I'm using:



function grepdata
grep '^Subject:'
postcat -q $1
grepdata $1









share|improve this question















closed as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga Dec 7 at 9:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    What have you accomplished so far? Please include your script in the question. This place is not a 'write this script for me' service.
    – Panki
    Dec 7 at 8:36










  • You seem to have made a good start.   Does the script you have now produce the desired information?  Is your question just a matter of how to format it?  What part is hard for you?
    – G-Man
    Dec 10 at 3:34














up vote
0
down vote

favorite












I have the following message output when I use postcat -q CEEFE416EAB5:



*** ENVELOPE RECORDS deferred/C/CEEFE416EAB5 ***
message_size: 375 253 1 0 375
message_arrival_time: Thu Dec 6 13:32:19 2018
create_time: Thu Dec 6 13:33:48 2018
named_attribute: rewrite_context=local
sender_fullname: root
sender: root@localhost.localdomain
original_recipient: testmailreciever001@localhost.com
recipient: testmailreciever001@localhost.com
*** MESSAGE CONTENTS deferred/C/CEEFE416EAB5 ***
Received: by localhost.localdomain (Postfix, from userid 0)
id CEEFE416EAB5; Thu, 6 Dec 2018 13:33:48 +0900 (JST)
From:testmailsender100@localhost.com
To:testmailreciever001@localhost.com
Subject:TestMail_Postfix
Message-Id: <20181206043348.CEEFE416EAB5@localhost.localdomain>
Date: Thu, 6 Dec 2018 13:32:19 +0900 (JST)

Sending Testmail to testmailreciever001

*** HEADER EXTRACTED deferred/C/CEEFE416EAB5 ***
*** MESSAGE FILE END deferred/C/CEEFE416EAB5 ***


I need to extract the output the subject and the recipient from the corresponding lines in the header (Subject: and recipient:) (using a shell script) in the following format, and to be write in the /var/log/message using logger



OUTPUT FORMAT:
QUEUE ID SUBJECT RECIPIENT

EXPECTED OUTPUT:
CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


Spaces have been added above
to clarify the column-oriented nature of the expected output. 
The expected output should actually separate the fields
with a single space:



CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


The commands I'm using:



function grepdata
grep '^Subject:'
postcat -q $1
grepdata $1









share|improve this question















closed as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga Dec 7 at 9:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    What have you accomplished so far? Please include your script in the question. This place is not a 'write this script for me' service.
    – Panki
    Dec 7 at 8:36










  • You seem to have made a good start.   Does the script you have now produce the desired information?  Is your question just a matter of how to format it?  What part is hard for you?
    – G-Man
    Dec 10 at 3:34












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have the following message output when I use postcat -q CEEFE416EAB5:



*** ENVELOPE RECORDS deferred/C/CEEFE416EAB5 ***
message_size: 375 253 1 0 375
message_arrival_time: Thu Dec 6 13:32:19 2018
create_time: Thu Dec 6 13:33:48 2018
named_attribute: rewrite_context=local
sender_fullname: root
sender: root@localhost.localdomain
original_recipient: testmailreciever001@localhost.com
recipient: testmailreciever001@localhost.com
*** MESSAGE CONTENTS deferred/C/CEEFE416EAB5 ***
Received: by localhost.localdomain (Postfix, from userid 0)
id CEEFE416EAB5; Thu, 6 Dec 2018 13:33:48 +0900 (JST)
From:testmailsender100@localhost.com
To:testmailreciever001@localhost.com
Subject:TestMail_Postfix
Message-Id: <20181206043348.CEEFE416EAB5@localhost.localdomain>
Date: Thu, 6 Dec 2018 13:32:19 +0900 (JST)

Sending Testmail to testmailreciever001

*** HEADER EXTRACTED deferred/C/CEEFE416EAB5 ***
*** MESSAGE FILE END deferred/C/CEEFE416EAB5 ***


I need to extract the output the subject and the recipient from the corresponding lines in the header (Subject: and recipient:) (using a shell script) in the following format, and to be write in the /var/log/message using logger



OUTPUT FORMAT:
QUEUE ID SUBJECT RECIPIENT

EXPECTED OUTPUT:
CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


Spaces have been added above
to clarify the column-oriented nature of the expected output. 
The expected output should actually separate the fields
with a single space:



CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


The commands I'm using:



function grepdata
grep '^Subject:'
postcat -q $1
grepdata $1









share|improve this question















I have the following message output when I use postcat -q CEEFE416EAB5:



*** ENVELOPE RECORDS deferred/C/CEEFE416EAB5 ***
message_size: 375 253 1 0 375
message_arrival_time: Thu Dec 6 13:32:19 2018
create_time: Thu Dec 6 13:33:48 2018
named_attribute: rewrite_context=local
sender_fullname: root
sender: root@localhost.localdomain
original_recipient: testmailreciever001@localhost.com
recipient: testmailreciever001@localhost.com
*** MESSAGE CONTENTS deferred/C/CEEFE416EAB5 ***
Received: by localhost.localdomain (Postfix, from userid 0)
id CEEFE416EAB5; Thu, 6 Dec 2018 13:33:48 +0900 (JST)
From:testmailsender100@localhost.com
To:testmailreciever001@localhost.com
Subject:TestMail_Postfix
Message-Id: <20181206043348.CEEFE416EAB5@localhost.localdomain>
Date: Thu, 6 Dec 2018 13:32:19 +0900 (JST)

Sending Testmail to testmailreciever001

*** HEADER EXTRACTED deferred/C/CEEFE416EAB5 ***
*** MESSAGE FILE END deferred/C/CEEFE416EAB5 ***


I need to extract the output the subject and the recipient from the corresponding lines in the header (Subject: and recipient:) (using a shell script) in the following format, and to be write in the /var/log/message using logger



OUTPUT FORMAT:
QUEUE ID SUBJECT RECIPIENT

EXPECTED OUTPUT:
CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


Spaces have been added above
to clarify the column-oriented nature of the expected output. 
The expected output should actually separate the fields
with a single space:



CEEFE416EAB5 TestMail_Postfix testmailreciever001@localhost.com


The commands I'm using:



function grepdata
grep '^Subject:'
postcat -q $1
grepdata $1






shell-script postfix text-formatting sendmail






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 10 at 5:12

























asked Dec 7 at 0:42









user322785

61




61




closed as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga Dec 7 at 9:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga Dec 7 at 9:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    What have you accomplished so far? Please include your script in the question. This place is not a 'write this script for me' service.
    – Panki
    Dec 7 at 8:36










  • You seem to have made a good start.   Does the script you have now produce the desired information?  Is your question just a matter of how to format it?  What part is hard for you?
    – G-Man
    Dec 10 at 3:34












  • 1




    What have you accomplished so far? Please include your script in the question. This place is not a 'write this script for me' service.
    – Panki
    Dec 7 at 8:36










  • You seem to have made a good start.   Does the script you have now produce the desired information?  Is your question just a matter of how to format it?  What part is hard for you?
    – G-Man
    Dec 10 at 3:34







1




1




What have you accomplished so far? Please include your script in the question. This place is not a 'write this script for me' service.
– Panki
Dec 7 at 8:36




What have you accomplished so far? Please include your script in the question. This place is not a 'write this script for me' service.
– Panki
Dec 7 at 8:36












You seem to have made a good start.   Does the script you have now produce the desired information?  Is your question just a matter of how to format it?  What part is hard for you?
– G-Man
Dec 10 at 3:34




You seem to have made a good start.   Does the script you have now produce the desired information?  Is your question just a matter of how to format it?  What part is hard for you?
– G-Man
Dec 10 at 3:34















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay