In case somebody wants them... here is our implementation of an Email utility
object that connects to an smtp server to send the email.
Using the classes in the jar file, you can send an email within your program by
creating an EmailReport object. I have not used JavaMail but it is probably fairly
similar.
EmailReport email = new EmailReport("mail.cse.com", "[EMAIL PROTECTED]",
"[EMAIL PROTECTED]", "message subject", "this is my message");
and the mail is sent.
"Craig R. McClanahan" wrote:
> Sorry to jump into this discussion late, but I've got an alternative to
> suggest.
>
> Do you have a local mail server (i.e. one that speaks SMTP on port 25) on your
> network? If so, you can just socket connect to this server and send all your
> messages through it. If it's properly configured (i.e. if you can send and
> receive Internet mail through it), the SMTP server will forward messages to the
> appropriate receiver (by doing the MX lookup and then forwarding the message to
> the mail server it finds).
>
> You are still going to need to send your message using the correct SMTP
> protocol commands. This is not difficult to do -- check out the Internet RFCs
> for mail (821 and 822 are the most important ones) to understand what is
> required. This is the complexity that JavaMail hides for you, because you have
> a nice object oriented interface to a mail transport service that does it all
> for you.
>
> Craig McClanahan
>
> Rolando Salangsang wrote:
>
> > Before I jump into the Java Mail APIs and just for curiosity sake, I too
> > would like to know if anyone knows how to do an MX lookup.
> >
> > Thanks again for the responses,
> > Rolando
> >
> > > ----------
> > > From: Nic Ferrier[SMTP:[EMAIL PROTECTED]]
> > > Reply To: A mailing list for discussion about Sun Microsystem's Java
> > > Servlet API Technology.
> > > Sent: Wednesday, March 10, 1999 1:01 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: e-mail
> > >
> > > I'm not a mail expert but don't you have to look up the MX host rather
> > > than just presuming that the domain name is the mail host?
> > >
> > > If you're not getting the recipient address from an email I think
> > > this is what you'll have to do.
> > >
> > > Anyone know of an easy way to do an MX lookup?
> > >
> > >
> > >
> > > Nic Ferrier
> > > Tapsell-Ferrier Ltd
> > > www.tapsellferrier.co.uk
> > >
> > >
> > > >>> Rolando Salangsang <[EMAIL PROTECTED]> 3/10/99 8:33:19 PM >>>
> > > Hello,
> > >
> > > I have an servlet that emails a confirmation message to a user after
> > > a they
> > > fill out a form. All seems to be working OK except for some
> > > "UnknownHost"
> > > Exceptions on some email addresses.
> > >
> > > I use the following sample code to obtain the host of the recipient:
> > >
> > > int indexOfAtSign = recipientAddress.indexOf('@');
> > > String host = recipientAddress.substring(indexOfAtSign + 1);
> > >
> > > I make a socket connection to the target as follows:
> > > Socket s = new Socket(host, SMTP_PORT);
> > >
> > > My questions are in regards to the recipient's email address:
> > > 1. If I try to test mail someone at <username>@notes.seagate.com, I
> > > will get
> > > an unknown host exception.
> > > 2. Am I missing something that a commercial email client does to the
> > > recipient's address? I can send this same message to the same address
> > > as
> > > question 1. without a problem.
> > >
> > > Any tips/ideas would be appreciated
> > >
> > > Thanks
> > > Rolando
> > >
> > > __________________________________________________________________________
> > > _
> > > 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
> > >
> > > __________________________________________________________________________
> > > _
> > > 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
> > >
> >
> > ___________________________________________________________________________
> > 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
>
> ___________________________________________________________________________
> 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
--
Jeremy Grant
Senior Software Engineer
DataMap - Bringing User-Centric Data Access To Your Desktop
Email.jar