Recipient name
Lesson 3 of 8 in Coddy's Email validator using Python course.
john@gmail.com
The bold part is the recipient name.
The recipient name represents an email mailbox that belongs to:
- A specific person
- A mailing list
- A department
- A role within a company (such as sales or customer service)
The recipient name may be a maximum of 64 characters long and consist of:
- Uppercase and lowercase letters in English (A-Z, a-z)
- Digits from 0 to 9
- Special characters such as ! # $ % & ' * + - / = ? ^ _ ` { |
A special character cannot appear as the first or last character in an email address or appear consecutively two or more times.
Challenge
MediumAdd to validate support for recipient name validation.
In out validator we will support easier terms, the recipient name should be a maximum of 24 characters and minimum of 3 characters long and consist of:
- Uppercase and lowercase letters in English (A-Z, a-z)
- Digits from 0 to 9
- The special characters - . (dot) and _ (underscore)
A special character cannot appear as the first or last character in an email address.
As before the function validate should return true if the input email is valid, and now also with recipient name validation
Try it yourself
def validate(email):
return email.count('@') == 1