On Tue, Jun 15, 1999 at 03:43:19PM -0300, Nelson wrote:
> In fact, I'll need to send mail attachments! Does anybody knows a good
> tutorial about the javamail API??
The API distribution includes some good examples. It's
been a while since I looked at it, but the idea is that each
message has a single "Content" object, and a Content object can
be any MIME type, including a multi-part.
A message begins with something like:
Session session = Session.getDefaultInstance(_props, null);
// _props is a Properties object that includes some
// JavaMail specific values
Message msg = new Message(session);
InternetAddress from = new InternetAddress("[EMAIL PROTECTED]");
msg.setFrom(from);
InternetAddress[] to = {new InternetAddress("[EMAIL PROTECTED]");}
msg.setRecipients(Message.RecipientType.TO, to);
msg.setSubject("This is the subject...");
This sets up everything about the message but the content.
If you want to send a simple text message:
msg.setContent("This is the content.", "text/plain");
AFAICR, sending an attachment means building a Multipart
object from multiple Part objects. I haven't done it, but it didn't
look too tough. Harder than using, say, Pine or Mutt to fire off
the message, but portable.
--
Robert Crawford [EMAIL PROTECTED]
http://www.iac.net/~crawford
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html