Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello all,
This is what I am trying to do...
I need to only allow email to be received that matches this pattern
<1[2-9]{10}@vm.myserver\.com>
I created a catch all for all mail. But now I want to reject any incoming mail that does not match that pattern hopefully in the SMTPD. I am hoping there is a way to do this. I am sure there is a better way to go about this. Any help would be appreciated.
I don't know if you can help me with another question.
I am trying to do TEXT SUBSTITUTION using header_checks. when an email comes in I want to add on additional chars. I have tested my regexp with postmap -q and it works great. But in my config when I receive an email it does not add the additional text
header_checks
Code:
if /^to:.*<[0-9]{7}@myserver\.com>/
/^to:(.*)<(.*)/ to:$(1)<1555$(2)
endif
in my config I have added
header_checks = regexp:/etc/postfix/header_checks
When the email hits the server the 1555 is not re-written in the email header.
Any clue?
Last edited by officecase; 04-11-2009 at 10:59 AM.
When the email is received I want to add on the area code to the email address before it drops the email into the users inbox. The end result should look like...
It would be easier to rewrite the envelope, as you did above using virtual_alias_maps, rather than the headers, since the "To:" header can contain several recipients, each one being in one of several forms, i.e.. "The Name" followed by <user@address.com>, or just a simple user@address.com (no name, no angle brackets); so you'll have to handle those possibilities (see RFC 2833). But, you can prepend the area code to a simple address of the form "[0-9]{7}@myserver.com" using something like
Code:
header_checks = regexp:/etc/postfix/header_checks
and
Code:
/^To: ([0-9]{7}@myserver\.com)$/ REPLACE To: 1555${1}
Yeah, people have used the word "scattered" to describe the postfix documentation. There's no substitute for the material on the site, but there are supplements. This page links to some of them. The two people mentioned near the top have each written a book, this and this. From what I recall (maybe someone will correct me), they both cover postfix around version 2.0 or 2.1, so they're a little out of date, but still good. I like the first for its brevity. Don't let the old publication date of the first put you off: it was published in late 2003, while the second in early 2005.
header_checks only works with one header at a time, and doesn't maintain state between headers. Each header -- one at a time -- is matched against pattern1 and pattern2 in the construct below:
Code:
if /pattern1/ ...
/pattern2/ ...
endif
So, what you're trying to do is not possible. It may be possible using a milter.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.