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











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:



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
{
postcat -q $1 | grep '^Subject:'
postcat -q $1 | grep '^recipient:'
}
grepdata $1









share|improve this question









New contributor




user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga 2 days ago


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
    2 days ago















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:



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
{
postcat -q $1 | grep '^Subject:'
postcat -q $1 | grep '^recipient:'
}
grepdata $1









share|improve this question









New contributor




user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga 2 days ago


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
    2 days ago













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:



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
{
postcat -q $1 | grep '^Subject:'
postcat -q $1 | grep '^recipient:'
}
grepdata $1









share|improve this question









New contributor




user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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:



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
{
postcat -q $1 | grep '^Subject:'
postcat -q $1 | grep '^recipient:'
}
grepdata $1






shell-script postfix text-formatting sendmail






share|improve this question









New contributor




user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 8 mins ago









G-Man

12.6k93064




12.6k93064






New contributor




user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 7 at 0:42









user322785

61




61




New contributor




user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user322785 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga 2 days ago


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.






put on hold as unclear what you're asking by G-Man, RalfFriedl, msp9011, Rui F Ribeiro, JigglyNaga 2 days ago


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
    2 days ago














  • 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
    2 days ago








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
2 days ago




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
2 days ago















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

サソリ

広島県道265号伴広島線

Accessing regular linux commands in Huawei's Dopra Linux