Yesterday I came across a request in which for a group of email users, the display name must be removed when sending to recipients outside the organization.
Concretely, those whose email is in format XXXX@domain.com (where XXXX are digits) must be “anonymized”. For example:
When certain of those users sends an email to an internal recipient, the header from should remain as: “John Doe <1234@domain.com>“, whereas when sending outside it should be: “<1234@domain.com>“.
These is easily accomplished by using a filter:
StripName: if header("From") == "^.*<[0-9][0-9][0-9][0-9]@domain.com>" {
edit-header-text("From", "^.*<", "<");
skip-filters();
}
In case you want to apply to another group of email users (or to all of them) , simply modify the condition, change the regex or remove it.
This is the way I added the filter in a Cluster Configuration environment:
(Machine smtp1.domain.com)> filters
NOTICE: This configuration command has not yet been configured for the current cluster mode (Machine smtp1.domain.com).
What would you like to do?
1. Switch modes to edit at mode "Cluster SMTP".
2. Start a new, empty configuration at the current mode (Machine smtp1.domain.com).
3. Copy settings from another cluster mode to the current mode (Machine smtp1.domain.com).
[1]> 1
[]> NEW
Enter filter script. Enter '.' on its own line to end.
StripName: if header("From") == "^.*<[0-9][0-9][0-9][0-9]@domain.com>"
{
edit-header-text("From", "^.*<", "<");
skip-filters();
}
.
1 filters added.
[]> LIST
Num Active Valid Name
1 Y Y StripName
[]>
(Cluster SMTP)> commit