Changeset 37788 in project


Ignore:
Timestamp:
07/25/19 00:21:12 (4 weeks ago)
Author:
andyjpb
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/email-address

    r30681 r37788  
    3535This API will take its argument and try to parse a single mailbox or group. If nothing parses or there are characters left over after the parsing completes then the parse fails and #f is returned.
    3636
     37===== email-address-list
     38
     39<procedure>(email-address-list string-port-or-lazy-sequence)</procedure>
     40
     41This API will take its argument and try to parse a list of addresses separated by commas or whitespace.
     42
     43It will parse as many addresses (mailboxes or groups) as it can. Any unparsable data will be returned in the 2nd value. If everything was parsable then the 2nd value will be #<lazy-null>.
     44
     45This parser is much more lenient than a To: header parser because it allows the addresses to be delimited with whitespace and it does not require the whole input to be parsable in order to succeed.
     46
     47==== Serialisers
     48
     49===== name->string
     50
     51<procedure>(name->string email-address)</procedure>
     52
     53Returns the name part of the address
     54
     55        > (use email-address)
     56        > (name->string (email-address "Andy Bennett <andyjpb@example.net>"))
     57        "Andy Bennett"
     58
     59===== local-part->string
     60
     61<procedure>(local-part->string email-address)</procedure>
     62
     63Returns the local part of the address as it appears in the original: the RFC allows MTAs to be case sensitive.
     64
     65        > (use email-address)
     66        > (local-part->string (email-address "Andy Bennett <ANDYJPB@EXAMPLE.NET>"))
     67        "ANDYJPB"
     68
     69===== local-part->string-ci
     70
     71<procedure>(local-part->string-ci email-address)</procedure>
     72
     73Returns a lower case version of the local part of the address. Use this if you know that the MTAs for the relevant domain are not case-sensitive. You can also use this to deduplicate addresses with mixed case local parts for domains with MTAs that are not case-sensitive.
     74
     75        > (use email-address)
     76        > (local-part->string-ci (email-address "Andy Bennett <ANDYJPB@EXAMPLE.NET>"))
     77        "andyjpb"
     78
     79===== domain-part->string
     80
     81<procedure>(domain-part->string email-address)</procedure>
     82
     83Returns a lower case version of the domain part of the address: DNS domain names are always case insensitive.
     84
     85        > (use email-address)
     86        > (domain-part->string (email-address "Andy Bennett <ANDYJPB@EXAMPLE.NET>"))
     87        "example.net"
     88
     89===== addr-spec->string
     90
     91<procedure>(addr-spec->string email-address)</procedure>
     92
     93Returns the local@domain part of the email-address, suitable for use in an SMTP dialogue. The case of the local part will be the same in the original address. The domain part will be lower case.
     94
     95        > (use email-address)
     96        > (addr-spec->string (email-address "Andy Bennett <ANDYJPB@EXAMPLE.NET>"))
     97        "ANDYJPB@example.net"
     98
    3799=== Examples
    38100
     
    43105        (email-address "Andy Bennett <andyjpb@example.net>")
    44106        (email-address "Andy Bennett <@home,@computer:andyjpb@example.net>")
    45         (email-address "Andy (the egg author) Bennett <andy.bennett@example.net>")
     107        (email-address "Andy (the egg author) Bennett <andy.bennett@example.net>") ; This one contains a comment that will not appear in the parsed output.
    46108        (email-address "\"Andy Bennett (Chicken)\" <andyjpb@example.net>")
    47109
     
    54116=== License
    55117
    56   Copyright (C) 2014, Andy Bennett
     118  Copyright (C) 2014-2019, Andy Bennett
    57119  All rights reserved.
    58120 
     
    82144
    83145=== Version History
    84 * Stand by for a stable release...
     146* 0.2, (2019/07/24) : I'm finally putting it into the CHICKEN coop!
     147* 0.1, (2014/04/11) : 0.1 was never available via `chicken-install` but if you installed it from git this is the version you would have got.
Note: See TracChangeset for help on using the changeset viewer.