postfix mail parsing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

postfix mail parsing

hyndavirapuru
Hi,


i have installed postfix 2.10 from source code. we are sending mail to
postfix server with custom headers. Based on those headers, some actions
need to be taken  at mail server. For that purpose i'm customizing postfix
source code.

In cleanup process, i'm able to parse all the custom headers. but in qmgr
process i'm not able to do that. In qmgr_active.c i have used
"attr_scan0_string" function to read header data from active queue file.
After reading the header data into a string, i'm printing the string value
using msg_info function.

With this I'm able to see all the header details. But all the headers are
separated by some token, which i'm not bale to make out.

msg_info output:
=================

Received: from localhost (localhost [127.0.0.1])N=?by AHQserver.tcs.mil.in
(Postfix) with ESMTP id 63D2F631FD43N??for <[hidden email]>; Fri, 14
Jul 2017 11:41:06 +0530 (IST)N+Date: Fri, 14 Jul 2017 11:41:06 +0530
(IST)N?From: [hidden email]?To: [hidden email].inN8Message-ID:
<83954662.0.1500012682422.JavaMail.root@AHQ>N)Subject: Greetings from
pgm.. testing altN?MIME-Version: 1.0N)Content-Type: text/html;
charset=us-asciiN?Content-Transfer-Encoding: 7bitN?precedence:
FlashN?security_level: Top SecretN


what are these junk characters in between the haeders? how can i parse the
headers?

I'm attaching my code with the mail. please take a look and let me know
where am i going wrong.

--
Thanks & Regards
Hyndavi rapuru
Member( Research Staff)
Central Research Laboratory
Bharat Electronics Ltd
Jalahalli
Bangalore- 560 013

Int Ph No: 134
Off Ph No: 080-28381125
Off Fax No: 28381168

कागज़ के 3000 पन्नों के लिए एक
पेड़ को काटा जाता है... पेड़
बचाएँ... पेड़ों का संरक्षण
करें... हरियाली लाएँ... इस मेल
का या इसकी किसी फाइल का
प्रिंट तब तक न लें जब तक
सचमुच ज़रूरत न हो !!!!

Every 3000 Sheets of paper costs us a tree.. Save trees... Conserve
Trees. Don't print this email or any Files unless you really need to!!!!

Confidentiality Notice/गोपनीय सूचना

इस इलेक्ट्रॉनिक संदेश में
शामिल जानकारी और इस संदेश के
साथ दिया गया संलग्नक केवल
प्रेषिती के अनन्य इस्तेमाल
के लिए है और इसमें गोपनीय या
विशेषाधिकार प्राप्त
जानकारी
शामिल हो सकती है । यदि आप
आशयित प्राप्तकर्ता नहीं
हैं, तो कृपया तुरंत भारत
इलेक्ट्रॉनिक्स के प्रेषक
को बताएँ
या [hidden email] पर मेल द्वारा
सूचित करें और इस संदेश की
सभी प्रतियाँ और उसके साथ लगे
संलग्नकों को नष्ट कर दें ।  The
information contained in this electronic message and any
attachments to this message are intended for the exclusive use of
the addressee(s) and may contain confidential or privileged
information. If you are not the intended recipient, please notify
the sender at Bharat Electronics  or [hidden email] immediately and
destroy all copies of this message and any attachments.






कागज़ के 3000 पन्नों के लिए एक पेड़ को काटा जाता है... पेड़ बचाएँ... पेड़ों का संरक्षण करें... हरियाली लाएँ... इस मेल का या इसकी किसी फाइल का प्रिंट तब तक न लें जब तक सचमुच ज़रूरत न हो !!!!
 

Every 3000 Sheets of paper costs us a tree.. Save trees... Conserve
Trees. Don't print this email or any Files unless you really need to!!!!

Confidentiality Notice/गोपनीय सूचना

इस इलेक्ट्रॉनिक संदेश में शामिल जानकारी और इस संदेश के साथ दिया गया संलग्नक केवल
प्रेषिती के अनन्य इस्तेमाल के लिए है और इसमें गोपनीय या विशेषाधिकार प्राप्त जानकारी
शामिल हो सकती है । यदि आप आशयित प्राप्तकर्ता नहीं हैं, तो कृपया तुरंत भारत इलेक्ट्रॉनिक्स के प्रेषक को बताएँ
या [hidden email] पर मेल द्वारा सूचित करें और इस संदेश की सभी प्रतियाँ और उसके साथ लगे संलग्नकों को नष्ट कर दें ।
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of
the addressee(s) and may contain confidential or privileged
information. If you are not the intended recipient, please notify
the sender at Bharat Electronics  or [hidden email] immediately
and destroy all copies of this message and any attachments.

custom_code (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: postfix mail parsing

Philip Paeps
On 2017-07-14 13:46:15 (+0530), [hidden email] <[hidden email]> wrote:
>i have installed postfix 2.10 from source code.

That's getting a little long in the tooth.

>we are sending mail to postfix server with custom headers. Based on
>those headers, some actions need to be taken  at mail server. For that
>purpose i'm customizing postfix source code.

I'm not sure why you feel you need to modify the Postfix source code to
process custom headers.  Why is `header_checks` not working for you?

In other words: "what problem are you trying to solve?"

This seems like Postfix should be able to "just do".

Philip

--
Philip Paeps
Senior Reality Engineer
Ministry of Information
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: postfix mail parsing

Viktor Dukhovni
In reply to this post by hyndavirapuru

> On Jul 14, 2017, at 4:16 AM, [hidden email] wrote:
>
> In cleanup process, i'm able to parse all the custom headers. but in qmgr
> process i'm not able to do that.

The queue manager is not the place for complex message content processing.
Your best bet is to write a milter or SMTP proxy filter.  Message routing
(the queue manager's job) can be customized via address rewriting.

--
        Viktor.

Loading...