This week's book giveaway is in the Open Source forum.
We're giving away four copies of RabbitMQ in Depth and have Gavin Roy on-line!
See this thread for details.
The moose likes Servlets and the fly likes Exception in the mail servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Exception in the mail servlet" Watch "Exception in the mail servlet" New topic

Exception in the mail servlet

Venkatachalapathi Madhes

Joined: Aug 25, 2000
Posts: 2
I tried out the following mail servlet .
I got the exception NosuchProvider Exception
What I have to do?
I am using VisualAge.
How can solve this probelm
import javax.mail.internet.*;
import javax.mail.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class email extends HttpServlet

String smtphost;
public void doGet(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,
public void mailsend()
java.util.Properties pro = System.getProperties();

//get the Session object to get control over service providers
Session ses = Session.getInstance(pro,null);
//create new message
Message mess = new MimeMessage(ses);

mess.setFrom(new InternetAddress(""));

mess.addRecipient(Message.RecipientType.TO, new InternetAddress(""));


mess.setText("pathi testing mail servlet");

System.out.println("Message over");

//Transport t = ses.getTransport("SMTP_MAIL");

catch(AddressException ade)
System.out.println("Address exception");

catch(SendFailedException sfe)
System.out.println("send failed exception");

catch(NoSuchProviderException nop)
System.out.println("No such provider");
catch(MessagingException me)
System.out.println("messaging exception");


public void init(ServletConfig conf) throws javax.servlet.ServletException



subject: Exception in the mail servlet