Closed Jaminy closed 8 years ago
Scan the body of the message for things that look like phone numbers. Phone numbers are unlikely to be in the headers, I'm not aware of any standards for adding phone numbers there.
What if there are numbers which are not phone numbers?Wouldn't be added as phone number?
Some phone numbers will be easy to recognise because they'll be a + followed by more than 7 or so numbers. Some will be harder, but it's a good bet that with less than 7 numbers it's probably not a phone number.
You can validate further by using the phonenumbers library. Start by doing .parse() and then you can use the phonenumbers.is_valid_number() function to check if it's a valid number.
For scanning telephone number in the message, should it scan for numbers in the message or the message starts with tel. ?