LogoLogo
  • Internet Object 1.0
  • Internet Object
    • Abstract
    • The Poetic Principles of Internet Object
    • Objectives
    • Introducing Internet Object
  • The Structure
    • Internet Object Document
      • Header
      • Data Sections
    • Structural Elements
      • Structural Characters and Literals
      • Literals
      • Other Special Characters
      • Whitespaces
    • Values Representations
      • Objects
      • Arrays
      • Strings
        • Open Strings
        • Regular Strings
        • Raw Strings
      • Numeric Values
        • Number
        • BigInt
        • Decimal
        • Special Numeric Integer Formats
          • Hexadecimal
          • Octal
          • Binary
        • NaN and Infinity
      • Binary
      • Date and Time
      • Booleans
      • Nulls
    • Comments
    • Encoding
  • The Collections
    • Collection
    • Creating Collection
    • Collection Rules
    • Data Streaming
  • The Definitions
    • Definitions
    • Variables
    • Complex Schema
  • Schema Definition Language
    • Internet Object Schema
    • The structure
    • Data Types
      • Any
      • String
        • String Derived Types
          • Email
          • URL
          • Date
          • Time
          • DateTime
      • Number
        • Derived Types
          • int
          • byte
          • int16
          • int32
      • Object
      • Array
      • Bool
    • Dynamic Schema
    • Is Object, a MemberDef or a Schema?
  • Other
    • Best Practices
    • FAQs
    • Contributors
    • License
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Schema Definition Language
  2. Data Types
  3. String
  4. String Derived Types

Email

PreviousString Derived TypesNextURL

Last updated 4 years ago

Was this helpful?

Other than regular string, raw string, and open string, a string can be passed as an Internet email as it is predefined in the parser. The email format is derived from the recommended by W3C. Internet Object Email Format does not follow the RFC-5322 email representation as it is too strict to implement for the users.

Email format follows the syntax specified in the

The code snippet shows how to define an email-id in the Internet Object Document.

# Defining an Email
userEmail: email
---
[email protected]
# Using  derived type email to pass email Information  
Subject: {
         string, 
         From: string, 
         To: string, senderEmail: email, 
         reciverEmail: email
         }
---
{    
     An official Email, 
     John Doe, Alex Wick, 
     [email protected],
     [email protected]
}

MemberDef

Choices

The choices can be added to member variables in the email so that it is restricted to the fixed set of available choices. Choices must be an array of valid emails. Here, the snippet shows how to add choices for the string subtype email.

# Assign choices for a companyEmail.  
companyEmail: {
  type: email, 
  choices: [[email protected], [email protected], 
              [email protected], [email protected]]
}
---
[email protected]

pattern

User may specify pattern for the email by defining pattern as shown in the snippet below.

# Set pattern for referenceEmail with type email.
referenceEmail: {
  type: email , 
  pattern: '[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$'
 }
---
~ [email protected]
~ [email protected]

The Email is derived from the String type, hence it shares the same as the String. However, Email enforces additional constraints with the respective email format.

HTML 5.1-Forms Email syntax
HTML 5.1 W3C recommendation under section 4.10.5.1.5.
MemberDef