LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-01-2018, 04:33 AM   #1
the_wildcat
LQ Newbie
 
Registered: Jul 2005
Posts: 2

Rep: Reputation: 0
Postfix: using regexp in sender_canonical


Hi there,

I'm readily admitting that I'm a novice with regexp.

Situation:
We need to change the sender on emails which end in domain.net but need two specific email addresses to be unchanged. So the mapping should look like this:

this.secure@domain.net = this.secure@domain.net
photocopier@domain.net = photocopier@domain.net
*@domain.net = photocopier@domain.net

I can get the "all others" to work with

/^.*@domain\.net/ photocopier@domain.net

but don't know how to put all the pieces together.

Thank you for any assistance in advance.
Michael
 
Old 11-01-2018, 05:24 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
probably you can tell us a few words about the language you use, the environment, the regexp style and other non-important things. Probably you can post a few pieces of code too. But only if you need some help to put those pieces together.
 
Old 11-01-2018, 06:12 AM   #3
the_wildcat
LQ Newbie
 
Registered: Jul 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Sorry, this is postfix on an Ubuntu 16.04 (yes I know, old kernel) server. Postfix is version 3.1.0. I think it's using pcre (php) in the background.

So in the main.cf I have:

sender_canonical_maps = regexp:/etc/postfix/sender_canonical

In the sender_canonical file, I have (currently):

/^.*@domain\.net/ photocopier@domain.net

This works just fine for changing the sender address on anything that comes in using a domain.net sender address. The issue is that if the sender is this.secure@domain.net, it gets changed to photocopier@domain.net.

That is the format of the file (as far as I can tell from reading man pages):
/reg exp/ <tab> new sender address
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
In Postfix mailserver how we can randomize transports using regexp (using $n ). haridas.nss Linux - Server 2 06-08-2010 01:59 PM
Postfix Regexp lookahead body check shudini Linux - Server 2 07-24-2009 08:32 AM
Postfix regexp header_checks issue shudini Linux - Server 4 06-07-2009 01:19 PM
How do I use a regexp in Postfix alias table? quackking Linux - Server 11 04-13-2007 12:10 PM
postfix regexp question wijnands Linux - Newbie 1 06-03-2004 06:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration