Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

javamail~~?

Thread view: 
albert85 - 12 Jan 2006 02:40 GMT
i want to know what javamail can do wat is it?
what te advantages for using the javamail?
what the differences between javamail and normal e-mail?????
Roedy Green - 12 Jan 2006 03:08 GMT
>i want to know what javamail can do wat is it?
>what te advantages for using the javamail?
>what the differences between javamail and normal e-mail?????

JavaMail sends and receives emails to a ordinary STMP/POP3 mail
server.  It is just a set of methods you can use to automate mail
tasks. You could use it for example to write a multiplatform email
program similar to Eudora.

I used it for example to write bulk mailer, then sends the same
message to many people, validating all the email addresses and
reporting on problems.

See http://mindprod.com/products1.html#BULK

Read the tutorial. It actually pretty easy. The JavaDoc is not very
useful until you understand how all the pieces fit together. It gives
you the code to create and unpack attachments and fiddle with the
various header fields.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

zero - 13 Jan 2006 18:22 GMT
> Read the tutorial. It actually pretty easy. The JavaDoc is not very
> useful until you understand how all the pieces fit together.

That is true for a lot of the more exotic parts of the java library, and
many third party libraries as well.  Javadoc should include more code
samples.

Writing good documentation is almost as hard as writing good code.

Signature

Beware the False Authority Syndrome

opalpa@gmail.com - 13 Jan 2006 18:46 GMT
Just a comment, althought not perfect, I find the amount of free and
quality Java examples to be above other systems I've worked on.   I
think the examples that do exist are of unusually high quality.  They
are way above Apple C examples, way above C# examples on ... forget the
site now... and Java code is usually much more readable then C++ and
many other languages.

So much quality & free stuff.

The moral of the story is look for examples when Javadoc is inadaquate.
If you define the following variables as String: username, password,
SMTP_HOST_NAME, SMTP_PORT, SSL_FACTORY, assign appropriate values, and
also somewhere in the code, before invocation, put
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());  the
following will send emails for you:

   public void sendSSLMessage(String recipients[], String subject,
           String message, String from) throws MessagingException {
       boolean debug = false;

       Properties props = new Properties();
       props.put("mail.smtp.host", SMTP_HOST_NAME);
       props.put("mail.smtp.auth", "true");
       props.put("mail.debug", "false");
       props.put("mail.smtp.port", SMTP_PORT);
       props.put("mail.smtp.socketFactory.port", SMTP_PORT);
       props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
       props.put("mail.smtp.socketFactory.fallback", "false");

       Session session = Session.getDefaultInstance(props,
               new javax.mail.Authenticator() {

                   protected PasswordAuthentication
getPasswordAuthentication() {
                       return new PasswordAuthentication(username,
password);
                   }
               });

       session.setDebug(debug);

       Message msg = new MimeMessage(session);
       InternetAddress addressFrom = new InternetAddress(from);
       msg.setFrom(addressFrom);

       InternetAddress[] addressTo = new
InternetAddress[recipients.length];
       for (int i = 0; i < recipients.length; i++) {
           addressTo[i] = new InternetAddress(recipients[i]);
       }
       msg.setRecipients(Message.RecipientType.TO, addressTo);
       msg.setSubject(subject);
       msg.setContent(message, "text/plain");
       Transport.send(msg);
   }

Have a fun day, http://www.geocities.com/opalpaweb/, opalpa@gmail.com
Thomas Weidenfeller - 16 Jan 2006 09:22 GMT
> That is true for a lot of the more exotic parts of the java library, and
> many third party libraries as well.  Javadoc should include more code
> samples.

JavaMail comes with a whole directory of example code. Why clutter the
documentation with that? The only thing IMHO missing in JavaMail's
javadoc are pointers to these examples - for those programmers who don't
check what they actually installed.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

zero - 16 Jan 2006 11:15 GMT
Thomas Weidenfeller <nobody@ericsson.invalid> wrote in news:dqfokn$7em$1
@news.al.sw.ericsson.se:

> The only thing IMHO missing in JavaMail's
> javadoc are pointers to these examples

That would work too.  For example a lot of the Swing GUI classes have links
to the (very good) Swing tutorial.  That is a very good solution imo.

Signature

Beware the False Authority Syndrome



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.