nosuchproviderexception

How to correct Invalid Protocol: null sending mail using javax.mail

若如初见. 提交于 2019-12-04 10:18:46
i'm trying to send mail in this way: Properties props = new Properties(); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", "out.alice.it"); props.setProperty("mail.user", "mymail@domain.it"); props.setProperty("mail.password", "*****"); Session mailSession = Session.getDefaultInstance(props, null); Transport transport = mailSession.getTransport(); MimeMessage message = new MimeMessage(mailSession); message.setFrom(new InternetAddress("Host", "Name")); On the row Transport transport... i retrieve this error: javax.mail.NoSuchProviderException: Invalid