Monday, December 23, 2013

i always get an exception on mail gettransport()

the code is not very complicated 
but i never go further gettransport

imports :

import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

and the source :

       String host = "";
       String username = "";
       String password = "yy";
       Properties props = new Properties();
       props.put("mail.smtp.starttls.enable", "true");
       props.put("mail.transport.protocol", "smtp");
       props.put("mail.smtp.auth", "true");
       Session session = Session.getInstance(props,null);
       //MimeMessage msg = new MimeMessage(session);
       // set the message content here
       Transport transport = session.getTransport("smtp");

and what i get:

javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment