R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
S: HELO USC-ISIF.ARPA
R: 250 BBN-UNIX.ARPA
S: MAIL FROM:<Smith@USC-ISIF.ARPA>
R: 250 OK
S: RCPT TO:<Jones@BBN-UNIX.ARPA>
R: 250 OK
S: RCPT TO:<Green@BBN-UNIX.ARPA>
R: 550 No such user here
S: RCPT TO:<Brown@BBN-UNIX.ARPA>
R: 250 OK
S: DATA
R: 354 Start mail input; end with <CRLF>.<CRLF>
S: Blah blah blah...
S: ...etc. etc. etc.
S: .
R: 250 OK
S: QUIT
R: 221 BBN-UNIX.ARPA Service closing transmission channel
writeHELO();
writeAUTH();
writeUSER(Username());
writePASS(Password());
writeMAILFROM(MailAddress());
setReceivers(To());
setReceivers(Cc());
setReceivers(Bcc());
writeDATA();
writeBody(mailAccount, mail);
private void writeHELO() throws Throwable {
this.write(CMD_HELO + InetAddress.getLocalHost().getHostName(), new byte[] {'2', '5', '0'});
}