magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2000 > 02 > Java@Work  

The Postman Always Rings Twice

Recently a reader dropped me a note about sending email from a Java applet. On the face of it, this sounds as though it should be a simple proposition, right? Java has plenty of built-in network support. How hard can it be to send email?

The truth is, there are several ways you can send email from a Java applet. However, each has its own peculiarities -- some of which are surprising. As with any programming problem, you make your choices and pay the trade-offs.

Why Email?

Why would you want a Java applet to send you email? One obvious reason is that you might want to create an applet that acts as a cross-platform email client. There are still plenty of other reasons. For example, you might want an applet to report an error condition to you via email. An applet could use email to send progress reports, registration requests, or any number of other pieces of data the applet collects or generates.

One thing to think about is how much user interaction you want. If you want the user to send you information, it might suffice to make the applet navigate to a mailto: URL. This brings up the user's email program and lets the user fill in and complete the email. There are some tricks you can use to automate the task, but you can't use this method to send email without the user's knowledge. That would be a serious security problem because I could send an email that mimics the user's. Sending a threatening letter, for example, would be very bad form.

For most applications, you'll want email to be transparent and not require user interaction.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2