The SMTP class accesses your local SMTP server. You will probably find
that your ISP has spam restrictions so that you can only send mail from
addresses within it's domain. You could try finding another
"spam-friendly" SMTP server somewhere...
Rhys
-----Original Message-----
From: Eberle Martin [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 22, 1999 1:16 AM
Subject: Re: Sending mail
Where can I get the package sun.net.smtp ?
Martin
Steven Lewis wrote:
> Not exactly a servlet question but I have written a servlet where
> users are presented a list of choices. After the choices are made
> I update a database and send the user a confirming email message.
> I have an email address for the user.
>
> When I try to send mail as shown below it works for addresses in my
ISP
> but for other domains it fails. How do I do this
>
> import sun.net.smtp.*;
> public class SendMail
> {
> public static String MY_ISP = "www.nwlink.com";
> public static String MY_EMAIL= "[EMAIL PROTECTED]";
>
> String subject;
> String message;
>
> ...
>
> protected void sendRecipientMessage(String recipientEmail)
> {
> try {
>
> // from and to
> SmtpClient sc = new SmtpClient(MY_ISP); // my ISP
> sc.from(MY_EMAIL);
> sc.to(recipientEmail);
> PrintStream ps = sc.startMessage();
>
> // additional headers, subject et al.
> ps.println("Subject: " + subject);
>
> // blank line separates the headers and message
> ps.println();
> ps.println(message);
> sc.closeServer();
> }
> catch (IOException e) {
> // Should really put up a dialog box informing user of the
error
> System.err.println(e);
> }
> }
>
> ==============================================================
> LordJoe - Java Training and Consulting
> http://www.LordJoe.com
>
>
________________________________________________________________________
___
> 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