SMTP : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

SMTP
SMTP (Simple Mail Transfer Protocol) The protocol most commonly used for sending mail to a server. In  Java version 1.2 or later you would use the JavaMail API (Application Programming Interface).
SmtpClient c = new SmtpClient( server );
c.from( sender );
c.to( recipient );
PrintStream p = c .startMessage();
p.println( "" );
p.println( "Subject: Test of SMTP Server" );
p.println( "" );
p.println( "Hi" );
c.closeServer();
SMTP is so simple you could roll your own code to send mail with it using a URLConnection.

SMTP is a kludgy anachronism. It lives on simply because everyone uses it. One of its major failings is a lack of authentication protocol. It has no official logon mechanism to prevent spammers from using your mail server to dispense SPAM. JavaMail still supports it.

Mail servers use various ad hoc schemes to protect themselves from unauthorised use:

  1. Looking at the FROM: and REPLY-TO: in the mail header. This is so easy to defeat, newbies do it by mistake.
  2. A manually maintained list of valid IP (Internet Protocol) permitted to use the server. Nasty people can still spoof IPs.
  3. You login with POP3 (Post Office Protocol version 3). Your IP goes into a temporary list of valid SMTP users. This means you must always attempt to pick up your mail immediately before sending any new mail.
  4. Kerberos login.
  5. A login command at the start of the SMTP session.
  6. More advanced mail protocols.

RFC 5321 describes the SMTP send mail protocol. You would use this to implement SendMail at the socket level with HELO commands and numbered responses.

If you talk to a mailserver, you can send mail to anyone in that domain without identifying yourself, however, if you want the mailserver to relay mail for you outside its domain, you need some way of identifying yourself. Mailservers drop off relayed mail using that same SMTP protocol.


This page is posted
on the web at:

http://mindprod.com/jgloss/smtp.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\smtp.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.147.47.177]
You are visitor number