i have tried using gmails sinetfactory to snd out the emails. i did it from 3 systems here in my office. the code:
import com.jscape.inet.smtpssl.*;
import com.jscape.inet.email.*;
import com.sun.net.ssl.internal.ssl.Provider;
import com.sun.net.ssl.TrustManager.*;
public class SmtpGmail {
public static void main(
String[] args) {
SmtpSsl smtp = null;
// gmail username - CHANGE THIS
String username = "
[email protected]";
// gmail password - CHANGE THIS
String password = "yourpassword";
// address to send mail to - CHANGE THIS
String to = "
[email protected]";
try {
// create a new SmtpSsl instance connecting securely via port 465 using implicit SSL
smtp = new SmtpSsl("smtp.gmail.com",465);
// establish secure connection
smtp.connect();
// login using gmail account details
smtp.login(username,password);
// create new email message
EmailMessage message = new EmailMessage();
message.setTo(to);
message.setFrom(username);
message.setSubject("Sending email via Gmail SMTP");
message.setBody("This is the body of the message");
// send message
smtp.send(message);
// disconnect
smtp.disconnect();
} catch(Exception e) {
// capture any exception and print to console
e.printStackTrace();
}
}
}
this thing worked here. but then i logged in to a remote server and tried the same thing. this is the response:
Exception in
thread "main" java.lang.NoClassDefFoundError: com/sun/net/ssl/Trust
Manager
at com.jscape.inet.ipclientssl.SecureSocket.getTrustAllManagers(Unknown
Source)
at com.jscape.inet.ipclientssl.SecureSocket.<init>(Unknown Source)
at com.jscape.inet.ipclientssl.IpClientSsl.connect(Unknown Source)
at com.jscape.inet.smtpssl.SmtpSsl.connect(Unknown Source)
at SmtpGmail.main(SmtpGmail.java:24)
if i can get some help on this it will be wonderful. cant get why it is complaining here abt a missing class.
thanks
harmeet