-
send email
i'm new in java
please help me i wont send Email but i can'd
i using by package SMTP with smtp.jar and i get error when i send email:
netscape.security.AppletSecurityException:
security.Couldn't connect to 'mailhost' with origin from 'local- classpath-classes'.
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code) at java.lang.RuntimeException.<init>(Compiled
Code)
at java.lang.SecurityException.<init>(Compiled
Code)
at netscape.security.AppletSecurityException.<init>(Compiled Code)
at netscape.security.AppletSecurityException.<init>(Compiled Code)
at netscape.security.AppletSecurity.checkConnect(Compiled Code)
at java.lang.SecurityManager.checkConnect(Compiled Code)
at java.net.InetAddress.getAllByName0(Compiled Code) at
java.net.InetAddress.getByName(Compiled Code)
at java.net.Socket.<init>(Compiled Code) at sun.net.NetworkClient.doConnect(Compiled
Code)
at sun.net.NetworkClient.openServer(Compiled Code) at sun.net.smtp.SmtpClient.openServer(Compiled
Code)
at sun.net.smtp.SmtpClient.<init>(Compiled Code) at sun.net.smtp.SmtpClient.<init>(Compiled
Code)*
at sendEMail.send(Compiled Code)
at forgot.actionPerformed (Compiled Code)
at java.awt.Button.processActionEvent(Compiled Code) at java.awt.Button.processEvent(Compiled
Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code) at java.awt.EventDispatchThread$EventPump.dispatchEvents
(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code) at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run (Compiled
Code)
this is code i use
public void send(String from, String to, String subject, String message)
{
try
{
System.out.println( "*** sendEMail : new SmtpClient");
SmtpClient client = new SmtpClient("localhost");
System.out.println( "*** sendEMail : client = " +
client.getMailHost());
// domains in both from and to must be valid!
client.from( from );
System.out.println( "*** sendEMail : client.from( from )");
client.to( to );
System.out.println( "*** sendEMail : client.to( to )");
PrintStream ps =
client.startMessage();
System.out.println( "*** sendEMail : client.startMessage ()");
//ps.println("Subject: " + subject);
//blank line between subject and message
ps.println();
System.out.println( "*** sendEMail : ps.println()");
ps.println(message );
System.out.println( "*** sendEMail : ps.println (message )");
client.closeServer();
System.out.println( "*** sendEMail : Sending sucssesful!");
}
catch( IOException ex )
{
System.out.println( "--- sendEMail : Sending failed: " +
ex.getMessage() );
}
thanks for advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|