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 = "auth.smtp.1and1.fr";
       String username = "xx@uu.com";
       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

thanks 

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment