Marc Knaup
07/21/2020, 1:06 PMinline class EmailAddress(val value: String)
for "<mailto:email@address.com|email@address.com>"
What is or should the combination of name + email address be called?
data class EmailRecipient(val address: EmailAddress, val name: String? = null)
?
EmailContact
? MailboxAddress
? EmailUser
? NamedEmailAddress
?
Got any idea or is there even any RFC definition for that?Matteo Mirk
07/21/2020, 3:58 PMMarc Knaup
07/21/2020, 4:05 PMNormally, a mailbox is comprised of two parts: (1) an optional display name that indicates the name of the recipient (which could be a person or a system) that could be displayed to the user of a mail application, and (2) an addr-spec address enclosed in angle brackets (“<” and “>”). There is also an alternate simple form of a mailbox where the addr-spec address appears alone, without the recipient’s name or the angle brackets.I’m trying to avoid something as generic as
Contact
.
Email functionality is usually just a tiny piece of a larger project and short names like that have a high chance of collision.
I had that problem just now where Contact
from an email library collides with Contact
from the CRM I’m writing.
Also, the idea is to not extend the the class with other properties in the future but have it only for that one purpose :)Matteo Mirk
07/21/2020, 4:24 PMMatteo Mirk
07/21/2020, 4:25 PMMarc Knaup
07/21/2020, 4:26 PMEmailRecipient
or alike look like in a standard library or an email library? 🙂Marc Knaup
07/21/2020, 4:27 PMContact
in autocompletion that I’d keep mixing up. And I’d need an implicit import in addition to a star-import.thanksforallthefish
07/22/2020, 8:10 AMContact
, not as much because of repetition (when we look at words, the same word can have different meaning and/or be used in different context) but mostly because you might fail to convey meaning. given your name
is optional and the rfc, MailboxAddress
looks the best choice to me, provided when you talk with colleagues/business you also use the same wording