Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-22-2011, 11:31 PM
Special Member
 
Posts: 117
Default change x-header-from and x-header-to while sending email

Hello guys,

I want to change x-header-from and x-header-to with specific values when somebody sends email from zimbra.

Basically, I want to implement a journaling server for my new zimbra setup. I will keep that journaling server email into BCC of every email sent from zimbra. But I want x-header-from should be set to journal@example.com and x-header-to should be all the TO and BCC list for journaling email.

Please let me know how can I achieve this kind of functionality.

Zimbra Version is: Release 7.1.0_GA_3140.UBUNTU10_64 UBUNTU10_64 NETWORK edition.

Thanks.
Reply With Quote
  #2 (permalink)  
Old 05-23-2011, 02:02 AM
Intermediate Member
 
Posts: 18
Default

Hi stalker,

I'd suppose you could achieve most of the desired functionality by tweaking the Zimbra's postfix, have a look at:
Postfix manual - header_checks(5)

But you have to be careful, because according to what you've written, the real recipient will see the BCC addresses of the message in the x-header-to field.

And why can't the journaling server use the real "From:" and "To:" fields?
__________________
Michal Belica - IT consultant
www.beli.sk
Reply With Quote
  #3 (permalink)  
Old 05-23-2011, 02:09 AM
Special Member
 
Posts: 117
Default

Quote:
Originally Posted by beli.sk View Post
Hi stalker,

I'd suppose you could achieve most of the desired functionality by tweaking the Zimbra's postfix, have a look at:
Postfix manual - header_checks(5)

But you have to be careful, because according to what you've written, the real recipient will see the BCC addresses of the message in the x-header-to field.

And why can't the journaling server use the real "From:" and "To:" fields?
Thanks for the link. Yes, journaling server can use from and to field. But I think we are going to alter from field. So, it will be same for every email.
Reply With Quote
  #4 (permalink)  
Old 05-23-2011, 02:44 AM
Special Member
 
Posts: 117
Default

Now I am able to add X-Header-From in to all emails. But cannot add second one.

I've wrote following file code into header_checks regexp map.

/^To: (.*)/ PREPEND X-Header-From: journaling@xyz.com
/^(Cc:|Bcc(.*)/ PREPEND X-Header-To: Should be cc and bcc

But it is not working. Can you tell me what is wrong?
Reply With Quote
  #5 (permalink)  
Old 05-23-2011, 03:10 AM
Intermediate Member
 
Posts: 18
Default

I'd rather prepend the X-Header-From line before "From:" because I could imagine that "To:" will be omited if the message is addressed to only BCCs.
And I think on the second line of your header checks, the pipe symbol should be escaped, but I'm not sure. I'd put it on separate lines with the same effect, just to be sure:
Code:
/^To: (.*)/ PREPEND X-Header-From: journaling@xyz.com
/^Cc: (.*)/ PREPEND X-Header-To: $1
/^Bcc: (.*)/ PREPEND X-Header-To: $1
Also note the $1 substitution.

But, hmm, I think that BCC is not part of the mail headers, BCCs get mentioned only in the SMTP communication when transporting the message.

Also note that the effect of this would be adding these headers to EVERY message that flows through the MTA in or out, unless you use some other forms of filtering.
__________________
Michal Belica - IT consultant
www.beli.sk

Last edited by beli.sk; 05-23-2011 at 03:11 AM.. Reason: Typo
Reply With Quote
  #6 (permalink)  
Old 05-23-2011, 03:23 AM
Special Member
 
Posts: 117
Default

Thanks.

Yes, I will add a filter when it's start working.

I've changed the lines in header_checks but still only X-Header-From is getting reflected in final message header. No X-Header-To entry found.
Reply With Quote
  #7 (permalink)  
Old 05-23-2011, 04:00 AM
Intermediate Member
 
Posts: 18
Default

Oh, I see, you'd only get the X-Header-To when the message contains CC or BCC. Try this:
Code:
/^From: (.*)/ PREPEND X-Header-From: journaling@xyz.com
/^To: (.*)/ PREPEND X-Header-To: $1
/^Cc: (.*)/ PREPEND X-Header-To: $1
/^Bcc: (.*)/ PREPEND X-Header-To: $1
But this means you'll have many X-Header-To lines, one for each of "To:", "Cc:" and "Bcc:" header line. If that's a problem you could do some more advanced logic in the header checks.
__________________
Michal Belica - IT consultant
www.beli.sk
Reply With Quote
  #8 (permalink)  
Old 05-23-2011, 04:07 AM
Special Member
 
Posts: 117
Default

Alright. Got it. So, when I've CC then only I will get X-Header-To. It's confirmed.

But I've kept one person in BCC. But I neither BCC address appended to X-Header-To nor another X-Header-To entry found.

Do you think that postfix will check BCC header?
Reply With Quote
  #9 (permalink)  
Old 05-23-2011, 04:30 AM
Intermediate Member
 
Posts: 18
Default

As I noted before, the BCC addresses are not put into the message headers (if they would, the recipients would be able to see them, defeating the purpose of BCC), so it's not possible to work on them as headers. At the moment I can't think of any trivial way to put them into a header apart from writing a filter program for postfix. But I wouldn't recomend doing so for the reason already mentioned.
__________________
Michal Belica - IT consultant
www.beli.sk
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.