REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 9-Feb-2010 Edit History |
An email address is a datatype. The email! datatype allows for easy expression of email addresses:
send luke@rebol.com {some message} emails: [ john@keats.dom lord@byron.dom edger@guest.dom alfred@tennyson.dom ] mesg: {poetry reading at 8:00pm!} foreach email emails [send email mesg]
Email is also one of the series datatypes, so the same rules that apply to series apply to emails:
probe head change/part jane@doe.dom "john" 4
john@doe.dom
The standard format of an email address is a name, followed by an at sign (@), followed by a domain. An email address can be of any length, but must not include any of restricted characters, such as square brackets, quotes, braces, spaces, newlines, etc..
The following email! datatype formats are valid:
info@rebol.com 123@number-mail.org my-name.here@an.example-domain.com
Upper and lower cases are preserved in email addresses.
Refinements can be used with an email value to get the user name or domain. The refinements are:
Here's how these refinements work:
email: luke@rebol.com
probe email/user
luke
probe email/host
rebol.com
The to-email function converts data to the email! datatype:
probe to-email "info@rebol.com"
info@rebol.com
probe to-email [info rebol.com]
info@rebol.com
probe to-email [info rebol com]
info@rebol.com
probe to-email [user some long domain name out there dom]
user@some.long.domain.name.out.there.dom
Use email? to determine whether a value is an email! datatype.
probe email? luke@rebol.com
true
As emails are part of the series! typeset, use series? to determine whether the value is a series:
probe series? luke@rebol.com
true
probe pick luke@rebol.com 5
#"@"
TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |