N
Nilambari
hi
i am facing a problem for SMTPTransport.openserver......
i am getting following error when i am trying to send email using
javamail servlet:
java.lang.NoSuchMethodError:
com.sun.mail.util.TraceInputStream.setQuote(Z)V
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:956)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:191)
at javax.mail.Service.connect(Service.java:233)
at javax.mail.Service.connect(Service.java:134)
at geezmail.makeTable(geezmail.java:169)
at geezmail.doPost(geezmail.java:99)
and the log says invalid protocoll: null
Following is my code for sending email:
Properties props = System.getProperties();
//props.setProperty("mail.host", "cyber");
props.setProperty("mail.smtp.host", "127.0.0.1");
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.smtp.port", "25");
props.setProperty("mail.user", "");
props.setProperty("mail.password", "");
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(true);
Transport transport = mailSession.getTransport("smtp");
//URLName urlname = new URLName("www.geezemail.com");
//com.sun.mail.smtp.SMTPTransport transport = new
com.sun.mail.smtp.SMTPTransport(mailSession, urlname);
MimeMessage message = new MimeMessage(mailSession);
message.setContent(msg, "text/html");
if (from.length() == 0){
return
"<center><table border=0>" +
"<tr>" +
"<td><H2>" + "From: field is not provided." +
"</H2></td>" +
"</tr>" +
"</table></center>";
}
else if (to.length() != 0) {
message.addRecipient(Message.RecipientType.TO, new
InternetAddress(to));
if (cc.length() != 0)
message.addRecipient(Message.RecipientType.CC, new
IernetAddress(cc));
if (bcc.length() != 0)
message.addRecipient(Message.RecipientType.BCC, new
InternetAddress(bcc));
message.setSubject(subject);
InternetAddress reply[] = new InternetAddress[1];
reply[0] = new InternetAddress(from);
message.setReplyTo(reply);
transport.connect("127.0.0.1",25,"","");//169
//message.saveChanges();
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
transport.close();
Can anybody help me?
Nilambari
(e-mail address removed)
i am facing a problem for SMTPTransport.openserver......
i am getting following error when i am trying to send email using
javamail servlet:
java.lang.NoSuchMethodError:
com.sun.mail.util.TraceInputStream.setQuote(Z)V
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:956)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:191)
at javax.mail.Service.connect(Service.java:233)
at javax.mail.Service.connect(Service.java:134)
at geezmail.makeTable(geezmail.java:169)
at geezmail.doPost(geezmail.java:99)
and the log says invalid protocoll: null
Following is my code for sending email:
Properties props = System.getProperties();
//props.setProperty("mail.host", "cyber");
props.setProperty("mail.smtp.host", "127.0.0.1");
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.smtp.port", "25");
props.setProperty("mail.user", "");
props.setProperty("mail.password", "");
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(true);
Transport transport = mailSession.getTransport("smtp");
//URLName urlname = new URLName("www.geezemail.com");
//com.sun.mail.smtp.SMTPTransport transport = new
com.sun.mail.smtp.SMTPTransport(mailSession, urlname);
MimeMessage message = new MimeMessage(mailSession);
message.setContent(msg, "text/html");
if (from.length() == 0){
return
"<center><table border=0>" +
"<tr>" +
"<td><H2>" + "From: field is not provided." +
"</H2></td>" +
"</tr>" +
"</table></center>";
}
else if (to.length() != 0) {
message.addRecipient(Message.RecipientType.TO, new
InternetAddress(to));
if (cc.length() != 0)
message.addRecipient(Message.RecipientType.CC, new
IernetAddress(cc));
if (bcc.length() != 0)
message.addRecipient(Message.RecipientType.BCC, new
InternetAddress(bcc));
message.setSubject(subject);
InternetAddress reply[] = new InternetAddress[1];
reply[0] = new InternetAddress(from);
message.setReplyTo(reply);
transport.connect("127.0.0.1",25,"","");//169
//message.saveChanges();
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
transport.close();
Can anybody help me?
Nilambari
(e-mail address removed)