Passa al contenuto principale

4.1.2. Sintassi dei comandi

I comandi consistono in un codice di comando seguito da un campo argomento. I codici di comando sono di quattro caratteri alfabetici. I caratteri alfabetici maiuscoli e minuscoli devono essere trattati in modo identico. Pertanto, uno qualsiasi dei seguenti può rappresentare il comando mail:

MAIL    Mail    mail    MaIl    mAIl

Ciò vale anche per qualsiasi simbolo che rappresenti valori di parametri, come "TO" o "to" per il forward-path. I codici di comando e i campi argomento sono separati da uno o più spazi. Tuttavia, all'interno degli argomenti reverse-path e forward-path la distinzione tra maiuscole e minuscole è importante. In particolare, in alcuni host l'utente "smith" è diverso dall'utente "Smith".

Il campo argomento consiste in una stringa di caratteri di lunghezza variabile che termina con la sequenza di caratteri <CRLF>. Il receiver non deve intraprendere alcuna azione finché non riceve questa sequenza.

Le parentesi quadre indicano un campo argomento facoltativo. Se l'opzione non viene scelta, si intende il valore predefinito appropriato.

Di seguito sono riportati i comandi SMTP:

HELO <SP> <host> <CRLF>

MAIL <SP> FROM:<reverse-path> <CRLF>

RCPT <SP> TO:<forward-path> <CRLF>

DATA <CRLF>

RSET <CRLF>

SEND <SP> FROM:<reverse-path> <CRLF>

SOML <SP> FROM:<reverse-path> <CRLF>

SAML <SP> FROM:<reverse-path> <CRLF>

VRFY <SP> <string> <CRLF>

EXPN <SP> <string> <CRLF>

HELP [<SP> <string>] <CRLF>

NOOP <CRLF>

QUIT <CRLF>

La sintassi dei campi argomento precedenti (usando la notazione BNF dove applicabile) è riportata di seguito. La notazione "..." indica che un campo può essere ripetuto una o più volte.

<reverse-path> ::= <path>

<forward-path> ::= <path>

<path> ::= "<" ["@" <host> "," ...] <mailbox> ">"

<host> ::= <a> <string> | "#" <number> | "[" <dotnum> "]"

<mailbox> ::= <user> "@" <host>

<user> ::= <string>

<string> ::= <char> | <char> <string>

<char> ::= <c> | '\' <c> | '\' <s>

<dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>

<number> ::= <d> | <d> <number>

<snum> ::= three digits representing a decimal integer value
in the range 0 through 255

<a> ::= any one of the 52 alphabetic characters A through Z
in upper case and a through z in lower case

<c> ::= any one of the 128 ASCII characters except
<specials>

<d> ::= any one of the ten digits 0 through 9

<s> ::= any one of <specials>

<specials> ::= '<', '>', '(', ')', '\', ',', ';', ':', '@',
'"', and the control characters (ASCII codes 0 through 37
octal inclusive and 177 octal)

Si noti che la barra rovesciata, '\', è un carattere di quotatura, usato per indicare che il carattere successivo deve essere usato in senso letterale (anziché secondo la sua interpretazione normale). Per esempio, "Joe\,Smith" potrebbe essere usato per indicare un singolo campo utente di nove caratteri in cui la virgola è il quarto carattere del campo.

Gli host sono generalmente conosciuti con nomi che vengono tradotti in indirizzi in ciascun host. A volte un host non è noto alla funzione di traduzione e la comunicazione è bloccata. Per aggirare questo ostacolo, per i "nomi" degli host sono ammesse anche due forme numeriche. Una forma è un intero decimale preceduto dal simbolo cancelletto, "#", che indica che il numero è l'indirizzo dell'host. Un'altra forma è costituita da quattro piccoli interi decimali separati da punti e racchiusi tra parentesi quadre, per esempio "[123.255.37.2]", che indica un indirizzo ARPA Internet a 32 bit in quattro campi da 8 bit.

La riga di marca temporale e la riga di percorso di ritorno sono definite formalmente come segue:

<return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF>

<time-stamp-line> ::= "Mail-From:" <SP> <stamp> <CRLF>

<stamp> ::= [<ptcl>] <from-host> <this-host> <daytime>

<ptcl> ::= <protocol> <SP> "host" <SP>

<from-host> ::= <host> <SP>

<this-host> ::= "received by" <SP> <host> <SP>

<protocol> ::= "TCP" | "NCP" | "NITS" | "X25" | "INTERNET" |
"ARPANET"

Note: INTERNET = TCP, ARPANET = NCP, and if the <ptcl> is
not present INTERNET is assumed.

<daytime> ::= "at" <SP> <date> <SP> <time>

<date> ::= <dd> "-" <mon> "-" <yy>

<time> ::= <hh> ":" <mm> ":" <ss> "-" <zone>

<dd> ::= the one or two decimal integer day of the month in
the range 1 to 31.

<mon> ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
"JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"

<yy> ::= the two decimal integer year of the century in the
range 01 to 99.

<hh> ::= the two decimal integer hour of the day in the
range 00 to 24.

<mm> ::= the two decimal integer minute of the hour in the
range 00 to 59.

<ss> ::= the two decimal integer second of the minute in the
range 00 to 59.

<zone> ::= a time zone designator (as in [2]) or "UT" for
Universal Time (the default).

Esempio di return path:

Return-Path: <@CHARLIE,@BAKER,JOE@ABLE>

Esempio di Mail From:

Mail-From: ABC received by XYZ at 22-OCT-81 09:23:59-PDT