Messaging Gateway

 View Only

Checking Turkish Republic ID Number(T.C Kimlik No) With Brightmail 

Dec 01, 2010 07:03 PM

Hello Friends,

In this topic i can help you about "how we can check Turkish Republic ID Numbers" on an email and what we can do after catch emails with that content.

Ok, actually it seems this topic just explains the control of Turkish Republic IDs but in the same logic and creating some RegEx functions we can control every pattern. So you can do your own examples easily after this.

 

1- Creating Pattern for Turkish Republic ID 

First of all we need to create our pattern to check in emails. Our ID have some limits. It must be numeric. First number doesn't be 0 and total count of number must be maximum 11.

So here's our RegEx defined:

^[1-9]{1}[0-9]{10}$

And here's how we can define it on Brightmail.

On the top menu click on "Content"

 

Then click "Patterns" on the left menu under the "Resources" tab.

 

Basic Pattern tab welcomes you after you click Patterns link. You can see Basic patterns built-in created by default. 

Click on Custom tab on the main page.

You'll see Add,Edit and Delete buttons. So you can edit or delete your own patterns after you create.

Click "Add" button.

 

On the "Pattern Name" enter an identification name for your pattern. You can choose patterns on the policies later with this name.

Enter our RegEx 

^[1-9]{1}[0-9]{10}$

to "Regular Expression" field. Then click "Save" button create our RegEx.

 

2- Creating Blank Content Policy

In the first step we created our own pattern that includes RegEx of "Turkish Republic ID Number"

Now it's time to create a policy template to use with it.

Click on "Email" on the left menu under the Policies tab.

Then click "Add" button on the main page to access new policy page.

Now you can see some policy templates that you can check for. All are these really useful templates and ease our life with a few steps. 

We'll use Blank template in our example, so click on "Blank" Radio button under Policy Template(by default it's selected) and then click "Select" button under of it.

This Content filtering policy page. On this page we can add conditions that will be match on emails. We can also add multiple conditions.

First enter a policy name that describing our policy to "Policy name" field.

Then click "Add" button on the main page.

As you can see,on the conditions page we can check every part of email with every single content.

Because of our mission we control Turkish Republic Id Number with our pattern that we created before. We'll check Turkish Republic Id Number in the Subject,Body or Attachment in the mail.

First click "Text in the Subject,Body or Attachment" radio button and then click forth radio button from top and select  "matches pattern" from drop down menu. On the right side of that list you can see another list that contains built-in patterns and our custom created patterns.

Click on that list and choose "TC Kimlik No(Custom)" on the list.

Here's what we can did on the top.

On the page below you can see a button called "Add condition". Click on that button to add our condition to the list.

3- Perform The Action

In first step we created our pattern and in the second step we added our pattern as a condition. In the third step we must choose an action to take when an email contains Turkish Republic ID Number in Subject,Body or Attachment parts. Brightmail gives us so many actions from routing mail to another server to sending quarantine. You can see all actions under the "Perform the following action" drop down list.

In our example we want to send our violated emails to administrator's email. So, choose "Forward a copy of the message" from the Action list. Another field named "Forward to" created after you choose. Add the your administrator's email address on that field. And then click "Add action" button to add action. By the way, we can also add multiple actions to the list that they all worked together.

In the final step we must assign this policy to a user group. All users are under "Default" group if you didn't created spesific user groups. So be sure to your policy group selected under the "Apply to the following policy groups" tab.

Finally,

Click on the "Save" button under the page to save our policy.

As you can see our policy listed below on the Email policy page and we can see that applied to Inbound and Outbound mails and apllied to 1 group.

I hope this option will help you to create your own patterns and email content policies.

Finally, you can use http://www.regexlib.com website to find RegEx already created and find some resources about "how can we create RegEx patterns".

Thank you

Regards,

Oykun

Statistics
0 Favorited
3 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Jun 09, 2020 05:11 AM

nice article but missing 

[1-9]{1}[0-9]{9}[02468]{1} is enough

we tested and worked

Jan 03, 2011 08:40 PM

Try this:

 

^[1-9]{1}[0-9]{9}[0,2,4,6,8]{1}$

 

1-9, once; 0-9, 9 times; an even digit, once

Jan 03, 2011 03:13 AM

Did you guys know that a TR ID cannot end with an odd number, the last digit is always an even number.

Oykun, how can we reflect this to the regex?

Dec 03, 2010 05:50 PM

Hello Buddy,

This is realy good article. Thank you ! :)

Best Regards.

Fatih

Related Entries and Links

No Related Resource entered.